-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Serializer] Docs for the PropertyInfo integration #7042
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
} | ||
|
||
$normalizer = new ObjectNormalizer(null, null, null, new ReflectionExtractor()); // | ||
$serializer = new Serializer(array(new DateTimeNormalizer(), $normalizer)); |
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.
Missing use statement for DateTimeNormalizer
.
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.
done
components/serializer.rst
Outdated
When using the Symfony Standard Edition, all normalizers are automatically configured to use registered extractors. | ||
When using the component standalone, an implementation of :class:`Symfony\\Component\\PropertyInfo\\PropertyTypeExtractorInterface`, | ||
(usually an instance of :class:`Symfony\\Component\\PropertyInfo\\PropertyInfoExtractor`) must be passed as the 4th | ||
parameter of the normalizer:: |
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.
"[...] to the ObjectNormalizer
"?
components/serializer.rst
Outdated
complex types (objects). The type of the class's property will be guessed using the provided | ||
extractor and used to recursively denormalize the inner data. | ||
|
||
When using the Symfony Standard Edition, all normalizers are automatically configured to use registered extractors. |
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.
[...] to use the registered [...]
components/serializer.rst
Outdated
----------------------------------------- | ||
|
||
The Serializer Component can use the :doc:`PropertyInfo Component </components/property_info>` to denormalize | ||
complex types (objects). The type of the class's property will be guessed using the provided |
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.
class'
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.
Are you sure? http://grammar.ccc.commnet.edu/grammar/possessives.htm
components/serializer.rst
Outdated
dump($obj->getDate()->format('Y-m-d')); // '1988-01-21' | ||
|
||
When a ``PropertyTypeExtractor`` is available, the normalizer will also check that the data to denormalize | ||
matches the type of the property (even for primitive types). For instance, if a ``string`` is provided but |
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.
[...] is provided, but [...]
components/serializer.rst
Outdated
|
||
When a ``PropertyTypeExtractor`` is available, the normalizer will also check that the data to denormalize | ||
matches the type of the property (even for primitive types). For instance, if a ``string`` is provided but | ||
the type of the property is ``int``, a :class:`Symfony\\Component\\Serializer\\Exception\\UnexpectedValueException` |
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.
an
Rebased and fixed. Status: Needs Review |
👍 LGTM Status: Reviewed |
Thank you @dunglas. |
…glas) This PR was submitted for the 3.1 branch but it was merged into the 3.2 branch instead (closes #7042). Discussion ---------- [Serializer] Docs for the PropertyInfo integration Docs for symfony/symfony#17660. Commits ------- 8e2deb0 [Serializer] Docs for the PropertyInfo integration
Docs for symfony/symfony#17660.