From cb319009f3bf97b8a7674d00fef7bda62293f0ab Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 21 Nov 2017 07:47:46 -0500 Subject: [PATCH 1/2] Fixing serializer config - much is now done automatically --- reference/configuration/framework.rst | 15 --- serializer.rst | 136 ++------------------------ 2 files changed, 7 insertions(+), 144 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 374edd23263..aa33f039851 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -106,7 +106,6 @@ Configuration * `debug`_ * `serializer`_ * :ref:`enabled ` - * :ref:`cache ` * :ref:`enable_annotations ` * :ref:`name_converter ` * :ref:`circular_reference_handler ` @@ -1656,20 +1655,6 @@ enabled Whether to enable the ``serializer`` service or not in the service container. -.. _reference-serializer-cache: - -cache -..... - -**type**: ``string`` - -The service that is used to persist class metadata in a cache. The service -has to implement the ``Doctrine\Common\Cache\Cache`` interface. - -.. seealso:: - - For more information, see :ref:`serializer-enabling-metadata-cache`. - .. _reference-serializer-enable_annotations: enable_annotations diff --git a/serializer.rst b/serializer.rst index 75b38c49d33..c79964d067d 100644 --- a/serializer.rst +++ b/serializer.rst @@ -20,52 +20,6 @@ Before using the serializer, run this command to install it in your application: $ composer require serializer -Then, enable the serializer in the framework config: - -.. configuration-block:: - - .. code-block:: yaml - - # config/packages/framework.yaml - framework: - # ... - serializer: { enable_annotations: true } - # Alternatively, if you don't want to use annotations - #serializer: { enabled: true } - - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php - - // config/packages/framework.php - $container->loadFromExtension('framework', array( - // ... - 'serializer' => array( - 'enable_annotations' => true, - // Alternatively, if you don't want to use annotations - //'enabled' => true, - ), - )); - Using the Serializer Service ---------------------------- @@ -147,46 +101,11 @@ Here is an example on how to load the Using Serialization Groups Annotations -------------------------------------- -Enable :ref:`serialization groups annotation ` -with the following configuration: - -.. configuration-block:: - - .. code-block:: yaml - - # config/packages/framework.yaml - framework: - # ... - serializer: - enable_annotations: true - - .. code-block:: xml - - - - - - - - - - +To use annotations, first install the annotations package: - .. code-block:: php +.. code-block:: terminal - // config/packages/framework.php - $container->loadFromExtension('framework', array( - // ... - 'serializer' => array( - 'enable_annotations' => true, - ), - )); + $ composer require annotations Next, add the :ref:`@Groups annotations ` to your class and choose which groups to use when serializing:: @@ -207,52 +126,11 @@ stored in one of the following locations: .. _serializer-enabling-metadata-cache: -Enabling the Metadata Cache ---------------------------- - -Metadata used by the Serializer component such as groups can be cached to -enhance application performance. Any service implementing the ``Doctrine\Common\Cache\Cache`` -interface can be used. - -A service leveraging `APCu`_ (and APC for PHP < 5.5) is built-in. - -.. configuration-block:: - - .. code-block:: yaml +Configruing the Metadata Cache +------------------------------ - # config/packages/prod/framework.yaml - framework: - # ... - serializer: - cache: serializer.mapping.cache.apc - - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php - - // config/packages/prod/framework.php - $container->loadFromExtension('framework', array( - // ... - 'serializer' => array( - 'cache' => 'serializer.mapping.cache.apc', - ), - )); +The metadata for the serializer is automatically cached. To configure the cache, +configure the ``framework.cache.pools`` key in ``config/packages/framework.yaml``. Enabling a Name Converter ------------------------- From 8634e409758b296cc043094cefe94a559e4ded53 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 23 Nov 2017 21:13:10 -0500 Subject: [PATCH 2/2] typo --- serializer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serializer.rst b/serializer.rst index c79964d067d..c7a3f0ee945 100644 --- a/serializer.rst +++ b/serializer.rst @@ -126,7 +126,7 @@ stored in one of the following locations: .. _serializer-enabling-metadata-cache: -Configruing the Metadata Cache +Configuring the Metadata Cache ------------------------------ The metadata for the serializer is automatically cached. To configure the cache,