diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index ce6216bb916..8781dff2bc9 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -26,6 +26,8 @@ Configuration * field_name * `session`_ * `lifetime`_ +* `serializer`_ + * enabled * `templating`_ * `assets_base_urls`_ * `assets_version`_ @@ -112,6 +114,36 @@ lifetime This determines the lifetime of the session - in seconds. By default it will use ``0``, which means the cookie is valid for the length of the browser session. +serializer +~~~~~~~~~~ + +enabled +....... + +**type**: ``boolean`` **default**: ``false`` + +Whether to enable or not the serializer service in the service container. If enabled, +the serializer will be loaded along with two encoders (:class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder` +and :class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder`) +but none normalizer. The :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer` is broken by design +so you are required to load it under your responsability. + +You can load more normalizers and/or encoders by tagging them as ``serializer.encoder`` and +``serializer.normalizer``. It's also possible to set the priority of the tag in order to decide the +matching order. + +Here an example on how to load the load +the :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`: + +.. code-block:: yaml + + # app/config/config.yml + services: + get_set_method_normalizer: + class: Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer + tags: + - { name: serializer.normalizer } + templating ~~~~~~~~~~ @@ -319,6 +351,10 @@ Full Default Configuration # DEPRECATED! Please use: cookie_httponly httponly: ~ + # serializer configuration + serializer: + enabled: false + # templating configuration templating: assets_version: ~ diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index fa7ea84e043..27d681653f1 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -42,6 +42,10 @@ the AsseticBundle has several tags that aren't listed here. +-----------------------------------+---------------------------------------------------------------------------+ | `security.listener.factory`_ | Necessary when creating a custom authentication system | +-----------------------------------+---------------------------------------------------------------------------+ +| `serializer.encoder`_ | Register a new encoder in the Serializer service | ++-----------------------------------+---------------------------------------------------------------------------+ +| `serializer.normalizer`_ | Register a new normalizer in the Serializer service | ++-----------------------------------+---------------------------------------------------------------------------+ | `swiftmailer.plugin`_ | Register a custom SwiftMailer Plugin | +-----------------------------------+---------------------------------------------------------------------------+ | `templating.helper`_ | Make your service available in PHP templates | @@ -558,6 +562,24 @@ is used behind the scenes to determine if the user should have access. The For more information, read the cookbook article: :doc:`/cookbook/security/voters`. +serializer.encoder +------------------ + +**Purpose**: Register a new encoder in the Serializer service + +You have to enable the Serializer service in order to use this tag. The class to +be tagged should extend the :class:`Symfony\\Component\\Serializer\\Encoder\\EncoderInterface` +and :class:`Symfony\\Component\\Serializer\\Encoder\\DecoderInterface` + +serializer.normalizer +--------------------- + +**Purpose**: Register a new normalizer in the Serializer service + +You have to enable the Serializer service in order to use this tag. The class to +be tagged should extend the :class:`Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface` +and :class:`Symfony\\Component\\Serializer\\Normalizer\\DenormalizerInterface` + swiftmailer.plugin ------------------