Skip to content

Commit

Permalink
Merge branch '5.4' into 6.0
Browse files Browse the repository at this point in the history
* 5.4:
  serializer: default context configuration symfony#16010
  [Form] Minor deletion
  Update form_collections.rst
  Update definition.rst
  Document by_reference option
  [HttpClient] HttpClientInterface::setResponseFactory method
  Update Monolog processors github url
  • Loading branch information
wouterj committed Jan 14, 2022
2 parents d7db41a + ab44ba8 commit 9f4383c
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 6 deletions.
6 changes: 4 additions & 2 deletions components/config/definition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,8 @@ character (``.``)::

$node = $treeBuilder->buildTree();
$children = $node->getChildren();
$path = $children['driver']->getPath();
$childChildren = $children['connection']->getChildren();
$path = $childChildren['driver']->getPath();
// $path = 'database.connection.driver'

Use the ``setPathSeparator()`` method on the config builder to change the path
Expand All @@ -831,7 +832,8 @@ separator::
$treeBuilder->setPathSeparator('/');
$node = $treeBuilder->buildTree();
$children = $node->getChildren();
$path = $children['driver']->getPath();
$childChildren = $children['connection']->getChildren();
$path = $childChildren['driver']->getPath();
// $path = 'database/connection/driver'

Processing Configuration Values
Expand Down
2 changes: 1 addition & 1 deletion form/form_collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ First, add a "delete this tag" link to each tag form:

.. code-block:: javascript
const tags = document.querySelectorAll('ul.tags')
const tags = document.querySelectorAll('ul.tags li')
tags.forEach((tag) => {
addTagFormDeleteLink(tag)
})
Expand Down
5 changes: 3 additions & 2 deletions form/form_customization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,9 @@ Renders any errors for the given field.
.. caution::

In the :ref:`error messages of Bootstrap 5 Form Theme <reference-forms-bootstrap5-error-messages>`,
``form_errors()`` is already included in ``form_label()``.
In the Bootstrap 4 form theme, ``form_errors()`` is already included in
``form_label()``. Read more about this in the
:ref:`Bootstrap 4 theme documentation <reference-forms-bootstrap5-error-messages>`.

.. _reference-forms-twig-widget:

Expand Down
17 changes: 17 additions & 0 deletions http_client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,23 @@ responses dynamically when it's called::
$client = new MockHttpClient($callback);
$response = $client->request('...'); // calls $callback to get the response

.. tip::

Instead of using the first argument, you can also set the (list of)
responses or callbacks using the ``setResponseFactory()`` method::

$responses = [
new MockResponse($body1, $info1),
new MockResponse($body2, $info2),
];

$client = new MockHttpClient();
$client->setResponseFactory($responses);

.. versionadded:: 5.4

The ``setResponseFactory()`` method was introduced in Symfony 5.4.

If you need to test responses with HTTP status codes different than 200,
define the ``http_code`` option::

Expand Down
2 changes: 1 addition & 1 deletion logging/processors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,4 @@ the ``monolog.processor`` tag:
->addTag('monolog.processor', ['channel' => 'main']);
.. _`Monolog`: https://github.com/Seldaek/monolog
.. _`built-in Monolog processors`: https://github.com/Seldaek/monolog/tree/master/src/Monolog/Processor
.. _`built-in Monolog processors`: https://github.com/Seldaek/monolog/tree/main/src/Monolog/Processor
2 changes: 2 additions & 0 deletions reference/forms/types/entity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ type:

.. include:: /reference/forms/types/options/attr.rst.inc

.. include:: /reference/forms/types/options/by_reference.rst.inc

.. include:: /reference/forms/types/options/data.rst.inc

.. include:: /reference/forms/types/options/disabled.rst.inc
Expand Down
43 changes: 43 additions & 0 deletions serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,49 @@ You can pass the context as follows::
DateTimeNormalizer::FORMAT_KEY => 'Y-m-d H:i:s',
]);

You can also configure the default context through the framework
configuration:

.. configuration-block::

.. code-block:: yaml
# config/packages/framework.yaml
framework:
# ...
serializer:
default_context:
enable_max_depth: true
.. code-block:: xml
<!-- config/packages/framework.xml -->
<framework:config>
<!-- ... -->
<framework:serializer>
<default-context enable-max-depth="true"/>
</framework:serializer>
</framework:config>
.. code-block:: php
// config/packages/framework.php
use Symfony\Config\FrameworkConfig;
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
return static function (FrameworkConfig $framework) {
$framework->serializer()
->defaultContext([
AbstractObjectNormalizer::ENABLE_MAX_DEPTH => true
])
;
};
.. versionadded:: 5.4

The ability to configure the ``default_context`` option in the
Serializer was introduced in Symfony 5.4.

.. _serializer-using-serialization-groups-annotations:

Using Serialization Groups Annotations
Expand Down

0 comments on commit 9f4383c

Please sign in to comment.