Comments (8)
Hi,
This will be hard to investigate without a reproducer, or at least more details (DBMS, entities, indexes...).
If it is urgent, feel free to send a mail at [email protected] to hire an expert from our team. I'm sure that it will resolve the issue quickly.
from api-platform.
The property filter is adding attributes to the serialization context dynamically, my first guess is that something is happening in the cache. Try to add attributes
at https://github.com/api-platform/core/blob/8e3a488103a51becd9c900ec5a3849b806121fbf/src/Serializer/CacheKeyTrait.php#L36 ? We're missing a lot of informations though:
- content type? are you using
jsonld
orjson
? - usage of the
security
option with the property filter - does the problem occurs with or without authentication ?
Please provide a reproducer at the email from the above message.
from api-platform.
Hello, we're using jsonld and the problem occurs with authentication.
What's absolutely crazy is that if I download the db and all configuration files and I start our app on my computer with exactly the same environment as production, it works well…
I tried to clear cache in production... Nothing.
In IGNORED_ATTRIBUTES, I should add attributes I don't want to cache ?
from api-platform.
In fact it's not the fix as they are present in the $context
. Not sure what's going on.
from api-platform.
I contacted Les Tilleuls this morning, waiting for an answer...
I hope someone can help me there.
from api-platform.
Could it be due to the fact that my database is still a postgre 13 ?
from api-platform.
We have probably made some progress in resolving the issue.
After further tests, we were finally able to reproduce the error in a dev env.
So we abandoned the track of the prod env problem.
In desperation, we tried to undo all the work we did to organize nicely our routes and filters into dedicated YAML files for each entity, to put it back in the PHP file, like it was at the origin.
On the tested entities, the bug of the erratic property filters disappeared…
But I can't wrap my head around it… How can it create such an incomprehensible bug ?
from api-platform.
We undid all this work and put it back in api/src/Entity/Marketing/Campaign.php
`
#api/config/api_platform/marketing/campaign.yaml
resources:
App\Entity\Marketing\Campaign:
operations:
# collectionOperations
ApiPlatform\Metadata\GetCollection:
filters:
[
"campaign.search_filter",
"campaign.boolean_filter",
"campaign.order_filter",
"entity.property_filter",
]
# itemOperations
get_campaign:
class: ApiPlatform\Metadata\Get
method: GET
uriTemplate: the_route
controller: the_controller
security: "is_granted('ROLE_role')"
securityMessage: "Access Denied."
patch_campaign:
class: ApiPlatform\Metadata\Patch
method: PATCH
uriTemplate: the_route
controller: the_controller
security: "is_granted('ROLE_role')"
securityMessage: "Access Denied."
ApiPlatform\Metadata\Delete:
security: "is_granted('ROLE_role')"
securityMessage: "Access Denied."
# workflow
re_deploy_campaign_in_ghl:
class: ApiPlatform\Metadata\Patch
method: PATCH
uriTemplate: the_route
controller: the_controller
security: "is_granted('ROLE_role')"
securityMessage: "Access Denied."
boss_acceptation:
class: ApiPlatform\Metadata\Patch
method: PATCH
uriTemplate: the_route
controller: the_controller
security: "(is_granted('ROLE_role') and user in object.getBusiness().getUsers().getValues()) or is_granted('ROLE_role')"
securityMessage: "Acces Denied"
send_draft:
class: ApiPlatform\Metadata\Patch
method: PATCH
uriTemplate: the_route
controller: the_controller
security: "(is_granted('ROLE_role') and user in object.getBusiness().getUsers().getValues()) or is_granted('ROLE_role')"
securityMessage: "Acces Denied"
geek_validation:
class: ApiPlatform\Metadata\Patch
method: PATCH
uriTemplate: the_route
controller: the_controller
security: "is_granted('ROLE_role') or is_granted('ROLE_role')"
securityMessage: "Acces Denied"
another_geek_validation:
class: ApiPlatform\Metadata\Patch
method: PATCH
uriTemplate: the_route
controller: the_controller
security: "is_granted('ROLE_role') or is_granted('ROLE_role')"
securityMessage: "Acces Denied"
another_geek_rejection:
class: ApiPlatform\Metadata\Patch
method: PATCH
uriTemplate: the_route
controller: the_controller
security: "is_granted('ROLE_role') or is_granted('ROLE_role')"
securityMessage: "Acces Denied"
boss_rejection:
class: ApiPlatform\Metadata\Patch
method: PATCH
uriTemplate: the_route
controller: the_controller
security: "(is_granted('ROLE_role') and user in object.getBusiness().getUsers().getValues()) or is_granted('ROLE_role')"
securityMessage: "Acces Denied"
cancel:
class: ApiPlatform\Metadata\Patch
method: PATCH
uriTemplate: the_route
controller: the_controller
security: "(is_granted('ROLE_role') and user in object.getBusiness().getUsers().getValues()) or is_granted('ROLE_role')"
securityMessage: "Acces Denied"
change_mind:
class: ApiPlatform\Metadata\Patch
method: PATCH
uriTemplate: the_route
controller: the_controller
security: "(is_granted('ROLE_role') and user in object.getBusiness().getUsers().getValues()) or is_granted('ROLE_role')"
securityMessage: "Acces Denied"
denormalizationContext:
groups: ["write:coach"]
properties:
App\Entity\Marketing\Campaign:
id: ~
name: ~
isActive: ~
dateFrom: ~
dateTo: ~
eventDateTo: ~
eventDateFrom: ~
passVIPduration: ~
budgetAmount: ~
budgetType: ~
offerDescription: ~
prizeDescription: ~
video: ~
guarantee: ~
broadcasts: ~
emailAutomatisms: ~
fbTitles: ~
fbCall2Actions: ~
fbMedias: ~
fbTexts: ~
wcScript: ~
wcPreviewLink: ~
followUpScenari: ~
followUpScript: ~
state: ~
reasonOfRefusal: ~
usersWhoApprove: ~
usersWhoRefuse: ~
# ghl
ghlTeamId:
security: 'is_granted("ROLE_role") or is_granted("ROLE_role")'
ghlTeam:
security: 'is_granted("ROLE_role") or is_granted("ROLE_role")'
# relation
offer: ~
services: ~
marketingPlan: ~
business: ~
`
`
#api/config/filter/marketing/campaign_filters.yaml
services:
campaign.search_filter:
parent: 'api_platform.doctrine.orm.search_filter'
arguments: [ {
business.id: 'exact',
business.name: 'ipartial',
marketingPlan.id: 'exact',
marketingPlan.isPermanent: 'exact',
name: 'ipartial',
state: 'exact',
} ]
tags: [ 'api_platform.filter' ]
campaign.boolean_filter:
parent: 'api_platform.doctrine.orm.boolean_filter'
arguments: [ {
isActive: 'exact',
} ]
tags: [ 'api_platform.filter' ]
campaign.order_filter:
parent: 'api_platform.doctrine.orm.order_filter'
arguments:
$properties: {
id: ~,
business.name: ~,
dateFrom: ~,
dateTo: ~,
}
$orderParameterName: order
tags: [ 'api_platform.filter' ]
`
from api-platform.
Related Issues (20)
- denormalizationContext imbrique
- New Format : RSS feed
- Open up Paginator::$documents for read
- 502 status code in "Check PWA reachability" ci step
- Specific order of operations in #ApiResource annotation causes incorrect API schema (using wrong serialization group)
- Impossible to use vite/vue3 with supplied Caddyfile HOT 3
- The event_listeners_backward_compatibility_layer: true is broken in version 3.3.0 HOT 1
- Building 3.3.2 for production throws: Error: <Html> should not be imported outside of pages/_document. HOT 3
- "Invalid identifier value or configuration." HOT 1
- ProcessorInterface multiple ProcessorInterfaces (persist & remove) && Security within State Providers
- Asset mapper warnings HOT 1
- Potential conflict between API Platform and Gedmo\Translatable
- Strange Api-platform activity. It looks like ApiProperty Attribute doesn't work with json format. Looks like a security issue. HOT 5
- Support indexes in query collection/array parameters
- Handling File Upload Error
- Why i am not able to deploy second time like first time i can in second i see this error
- Why i am not able to deploy second time like first time i can in second i see this error
- How to handle Custom Filter Queries in Symfony - compatible with api platform HOT 1
- Custom messenger bus & custom dto cannot be used at the same site
- Filters incompatible with PHP 8.2.20 and 8.3.8 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from api-platform.