-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Serializer] Add docs for attributes context key #8830
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
Conversation
components/serializer.rst
Outdated
$serializer = new Serializer(array(new ObjectNormalizer())); | ||
|
||
$data = $serializer->normalize($user, null, array('attributes' => array('familyName', 'company' => ['name']))); | ||
// $data = array('familyName' => 'Dunglas', 'company' => ['name' => 'Les-Tilleuls.coop']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'company' => ['name' ...
-> 'company' => array('name' ...
components/serializer.rst
Outdated
Only attributes that are not ignored (see below) are available. | ||
If some serialization groups are set, only attributes allowed by those groups can be used. | ||
|
||
As for groups, attributes can be applied during both the serialization and deserialization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what this phrase means -> "As for groups, attributes can be applied during both the serialization and deserialization."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfectly explained, concise and with a good example.
Thank you!
Thanks @dunglas! |
…as, javiereguiluz) This PR was merged into the 3.3 branch. Discussion ---------- [Serializer] Add docs for attributes context key Documentation for symfony/symfony#18834 Commits ------- d48d6d4 Minor reword ea211ab Review 5d75696 [Serializer] Add docs for attributes context key
Documentation for symfony/symfony#18834