Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
Updated the serializer/* articles to Symfony 4#8687
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -4,19 +4,23 @@ | ||
| How to Use the Serializer | ||
| ========================= | ||
| Symfony provides a serializertoserialize/deserialize toand from objects and | ||
| different formats (e.g.JSON or XML). Before using it, read the | ||
| :doc:`Serializercomponent docs</components/serializer>` to get familiar with | ||
| its philosophy and the normalizers and encoders terminology. | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I don't like this. It's not something to fix now, but the user should be able to get all their basic info right here on this article. Probably more of the components docs need to move here. | ||
| .. _activating_the_serializer: | ||
| Installing the Serializer | ||
| ------------------------- | ||
| Before using the serializer, run this command to install it in your application: | ||
| .. code-block:: terminal | ||
| $ composer require serializer | ||
| Then, enable the serializer in the framework config: | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This is needed? I see that indeed it is! Shouldn't we fix this with a recipe? It won't block this PR, but we should look into that. Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Wait, no, I think this is wrong. I think it auto-enables when the serializer is present. | ||
| .. configuration-block:: | ||
| @@ -65,7 +69,7 @@ it in your configuration: | ||
| Using the Serializer Service | ||
| ---------------------------- | ||
| Once enabled, the serializer service can be injected in any service where | ||
| you need it or it can be used in a controller:: | ||
| // src/Controller/DefaultController.php | ||
| @@ -85,7 +89,7 @@ you need it or it can be used in a controller:: | ||
| Adding Normalizers and Encoders | ||
| ------------------------------- | ||
| Once enabled, the serializer service will be available in the container | ||
| and will be loaded with four :ref:`encoders <component-serializer-encoders>` | ||
| (:class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder`, | ||
| :class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder`, | ||
| @@ -193,12 +197,12 @@ to your class and choose which groups to use when serializing:: | ||
| ); | ||
| In addition to the ``@Groups`` annotation, the Serializer component also | ||
| supportsYAML or XML files. These files are automatically loaded when being | ||
| stored in one of the following locations: | ||
| * The ``serialization.yaml`` or ``serialization.xml`` file in | ||
| the ``Resources/config/`` directory of a bundle; | ||
| * All ``*.yaml`` and ``*.xml`` files in the ``Resources/config/serialization/`` | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Here it would be necessary to mention the mapping paths introduced by the user, the default translations path and the overridden ones, in the order they are loaded. | ||
| directory of a bundle. | ||
| .. _serializer-enabling-metadata-cache: | ||
| @@ -302,9 +306,9 @@ take a look at how this bundle works. | ||
| .. toctree:: | ||
| :maxdepth: 1 | ||
| serializer/encoders | ||
| serializer/custom_encoders | ||
| .. _`APCu`: https://github.com/krakjoe/apcu | ||
| .. _`ApiPlatform`: https://github.com/api-platform/core | ||