-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[WCM] Added documentation to cover PR #6951 on serializer component. #2270
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
[WCM] Added documentation to cover PR #6951 on serializer component. #2270
Conversation
I've added documentation for setIgnoredAttributes too, thx. |
@@ -96,6 +96,16 @@ The first parameter of the :method:`Symfony\\Component\\Serializer\\Serializer:: | |||
is the object to be serialized and the second is used to choose the proper encoder, | |||
in this case :class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder`. | |||
|
|||
As an option, there's a way to ignore attributes from the origin object to be serialized, | |||
to remove those attributes use setIgnoredAttributes method on normalizer definition:: | |||
|
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.
Please, add a use
statement for the JsonEncoder
and GetSetMethodNormalizer
here.
I was using github editor, sorry about that! Updated! |
Hi @wouterj ! PR#6951 has been merged (symfony/symfony#6951) , is there anything else to modify on this docu? Any improvement? |
$normalizer->setIgnoredAttributes(array('age')); | ||
$encoder = new JsonEncoder(); | ||
|
||
$serializer = new Serializer(array($normalizer), array($encoder)); |
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.
You forgot the use statement for this class
ping @weaverryan except these last comments, it ready to be merged. |
Updated @wouterj Thx! /cc: @weaverryan |
…melcase [WCM] Added documentation to cover PR #6951 on serializer component.
Hi Marcos! I've merged in this PR with minor changes at sha: 047b9fe Thanks for this nice feature! |
.. versionadded:: 2.3
That PR covers PR #6951, enables camelCase formater on deserialize process , that way attributes as attribute_name could be implemented as attributteName parameter, with getAttributeName and setAttributeName, giving different formating option from setAttribute_name getAttribute_name.