Skip to content

Commit 6b404e2

Browse files
committed
Merge branch '4.2'
* 4.2: Update serializer.rst use correct code block for examples Fix little layout problem
2 parents cf8e851 + 2ce1139 commit 6b404e2

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

components/serializer.rst

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -938,17 +938,23 @@ The ``setCircularReferenceLimit()`` method of this normalizer sets the number
938938
of times it will serialize the same object before considering it a circular
939939
reference. Its default value is ``1``.
940940

941+
.. deprecated:: 4.2
942+
943+
The :method:`Symfony\\Component\\Serializer\\Normalizer\\AbstractNormalizer::setCircularReferenceHandler`
944+
method is deprecated since Symfony 4.2. Use the ``circular_reference_handler``
945+
key of the context instead.
946+
941947
Instead of throwing an exception, circular references can also be handled
942948
by custom callables. This is especially useful when serializing entities
943949
having unique identifiers::
944950

945951
$encoder = new JsonEncoder();
946-
$normalizer = new ObjectNormalizer();
947-
948-
// all callback parameters are optional (you can omit the ones you don't use)
949-
$normalizer->setCircularReferenceHandler(function ($object, string $format = null, array $context = []) {
950-
return $object->getName();
951-
});
952+
$defaultContext = [
953+
AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER => function ($object, $format, $context) {
954+
return $object->getName();
955+
},
956+
];
957+
$normalizer = new ObjectNormalizer(null, null, null, null, null, null, $defaultContext);
952958

953959
$serializer = new Serializer([$normalizer], [$encoder]);
954960
var_dump($serializer->serialize($org, 'json'));

form/form_customization.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The next step is to use the :ref:`form_start() <reference-forms-twig-start>`,
3030
:ref:`form_row() <reference-forms-twig-row>` Twig functions to render the
3131
different form parts so you can customize them adding HTML elements and attributes:
3232

33-
.. code-block:: twig
33+
.. code-block:: html+twig
3434

3535
{{ form_start(form) }}
3636
<div class="my-custom-class-for-errors">

form/form_themes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ A form can also be customized by applying several themes. To do this, pass the
122122
path of all the Twig templates as an array using the ``with`` keyword (their
123123
order is important, because each theme overrides all the previous ones):
124124

125-
.. code-block:: html+twig
125+
.. code-block:: twig
126126
127127
{# apply multiple form themes but only to the form of this template #}
128128
{% form_theme form with [

security.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ Frequently Asked Questions
963963
To see if this is an issue, check your log file (``var/log/dev.log``) for
964964
the log message:
965965

966-
> Cannot refresh token because user has changed.
966+
**Cannot refresh token because user has changed**
967967

968968
If you see this, there are two possible causes. First, there may be a problem
969969
loading your User from the session. See :ref:`user_session_refresh`. Second,

0 commit comments

Comments
 (0)