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)
- Building API Plaform behind corporate proxy and injected certificate
- Versioning. Did version 3.2.16 changed? HOT 3
- ValidationException returns stack trace instead of a list of violations
- API Platform GraphQL Operation Provider Error
- Serialization incomplete on JOINED inheritance subclass
- Cannot Start Environment with Docker-Compose on MacBook M1 Sonoma HOT 2
- api-platform.com domain does not resolve HOT 2
- Is it possible to use a filter feature separate from api-platform?
- Subresource Identifier
- Validation of path parameters HOT 1
- http instead https docs.jsonld
- Use of property class on APIResource Tag
- Custom Controller via POST accessible, not via GET-Collection
- UniqueEntity not fully working on PUT HOT 4
- Error "Unable to generate an IRI" if id has "." or ":"
- what is the best way to add current user information related to GetCollection request HOT 5
- SwaggerUI shows error: Unable to render this definition HOT 1
- Redundant @context field in OpenAPI for embedded JSON+LD resources
- denormalizationContext imbrique
- New Format : RSS feed
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.