-
-
Notifications
You must be signed in to change notification settings - Fork 966
normalization context don't work on symfony v5.1.99 #1576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
did you add the same normalization group to every property in your entity? |
I tested in both cases and it doesn't work, with all property in the same group and with 2 propertie in the group and here is only one group in this entity. |
from the little you provided, the route seems to be returning the expected result. Can you post the entire entity here? I think you are messing up somewhere with the denormalization groups. |
I do not have denormalization groups just a normalization, it is not necessary to create a group. my code worked on symfony 5.0 and 4.4 |
well, if you don't want to post your entity, I don't know how to help. I'm running 5.1 and I have no issues. Do you have custom normalizers defined? |
`<?php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; /**
|
this is my entity i don't have custom normalizer |
did you find a solution ? |
not really, I downgraded symfony to 5.0 and it works, I haven't tried again since |
Try to run |
there is no cache that does not fix the bug |
for me |
after trying it works! thanks for the help ! |
Worked also for me !! |
@dParadiz clearing the cache solved my problem after 3 hours of wondering why a simple |
Same problem but with post operation, cache clearing does not fix it... |
Bus somewhy if I add write group to setter method it magically works...
|
Worked for me!! thank youu |
In my own case, I did, out of 5, only two appeared in the api documentation. |
API Platform version(s) affected: x.y.z
Description
when i make my normalization context on symfony 5.1.99 in api ressource like that :
normalizationContext={"groups"={"read:question"}}
my model disapear in the api documentation and the api return 200 code but don't return element from database, only context from hydra
How to reproduce
normalizationContext={"groups"={"read:question"}} in api ressource and @groups in a entity.
and serializer: { enable_annotations: true } in config/package/framework.yamls
Possible Solution
i think it's cause it's a newest version.
Additional Context
this is worked on symfony 4.4

my php version is 7.3.14
The text was updated successfully, but these errors were encountered: