Answer the question
In order to leave comments, you need to log in
How to not show User Entity password in Symfony?
I came across this annotation and forgot it. I can't find any.
When serializing an object to json and passing it to the client, Symphony also gives the password, email, and other information about the user. I remember that it was possible to somehow configure it so that during serialization it was possible to serialize only specific fields. Tell me please.
$normalizer->setIgnoredAttributes(array('age')); y will not fit. It is necessary to do this at the Entity level, since serialization takes place in a third-party Bundle
Answer the question
In order to leave comments, you need to log in
https://github.com/symfony/symfony/blob/master/src...
Have you implemented this method? It just needs to clear the critical fields.
If you need to exclude not only the password, but also some fields, such as 'age', as in the example, then look towards the custom Normalizer for a specific object.
https://symfony.com/doc/current/components/seriali...
https://php-and-symfony.matthiasnoback.nl/2012/01/...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question