Skip to content

Commit 9f4383c

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: serializer: default context configuration #16010 [Form] Minor deletion Update form_collections.rst Update definition.rst Document by_reference option [HttpClient] HttpClientInterface::setResponseFactory method Update Monolog processors github url
2 parents d7db41a + ab44ba8 commit 9f4383c

File tree

7 files changed

+71
-6
lines changed

7 files changed

+71
-6
lines changed

components/config/definition.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,8 @@ character (``.``)::
820820

821821
$node = $treeBuilder->buildTree();
822822
$children = $node->getChildren();
823-
$path = $children['driver']->getPath();
823+
$childChildren = $children['connection']->getChildren();
824+
$path = $childChildren['driver']->getPath();
824825
// $path = 'database.connection.driver'
825826

826827
Use the ``setPathSeparator()`` method on the config builder to change the path
@@ -831,7 +832,8 @@ separator::
831832
$treeBuilder->setPathSeparator('/');
832833
$node = $treeBuilder->buildTree();
833834
$children = $node->getChildren();
834-
$path = $children['driver']->getPath();
835+
$childChildren = $children['connection']->getChildren();
836+
$path = $childChildren['driver']->getPath();
835837
// $path = 'database/connection/driver'
836838

837839
Processing Configuration Values

form/form_collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ First, add a "delete this tag" link to each tag form:
531531

532532
.. code-block:: javascript
533533
534-
const tags = document.querySelectorAll('ul.tags')
534+
const tags = document.querySelectorAll('ul.tags li')
535535
tags.forEach((tag) => {
536536
addTagFormDeleteLink(tag)
537537
})

form/form_customization.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,9 @@ Renders any errors for the given field.
268268
269269
.. caution::
270270

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

274275
.. _reference-forms-twig-widget:
275276

http_client.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,6 +1675,23 @@ responses dynamically when it's called::
16751675
$client = new MockHttpClient($callback);
16761676
$response = $client->request('...'); // calls $callback to get the response
16771677

1678+
.. tip::
1679+
1680+
Instead of using the first argument, you can also set the (list of)
1681+
responses or callbacks using the ``setResponseFactory()`` method::
1682+
1683+
$responses = [
1684+
new MockResponse($body1, $info1),
1685+
new MockResponse($body2, $info2),
1686+
];
1687+
1688+
$client = new MockHttpClient();
1689+
$client->setResponseFactory($responses);
1690+
1691+
.. versionadded:: 5.4
1692+
1693+
The ``setResponseFactory()`` method was introduced in Symfony 5.4.
1694+
16781695
If you need to test responses with HTTP status codes different than 200,
16791696
define the ``http_code`` option::
16801697

logging/processors.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,4 @@ the ``monolog.processor`` tag:
282282
->addTag('monolog.processor', ['channel' => 'main']);
283283
284284
.. _`Monolog`: https://github.com/Seldaek/monolog
285-
.. _`built-in Monolog processors`: https://github.com/Seldaek/monolog/tree/master/src/Monolog/Processor
285+
.. _`built-in Monolog processors`: https://github.com/Seldaek/monolog/tree/main/src/Monolog/Processor

reference/forms/types/entity.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ type:
284284

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

287+
.. include:: /reference/forms/types/options/by_reference.rst.inc
288+
287289
.. include:: /reference/forms/types/options/data.rst.inc
288290

289291
.. include:: /reference/forms/types/options/disabled.rst.inc

serializer.rst

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,49 @@ You can pass the context as follows::
111111
DateTimeNormalizer::FORMAT_KEY => 'Y-m-d H:i:s',
112112
]);
113113

114+
You can also configure the default context through the framework
115+
configuration:
116+
117+
.. configuration-block::
118+
119+
.. code-block:: yaml
120+
121+
# config/packages/framework.yaml
122+
framework:
123+
# ...
124+
serializer:
125+
default_context:
126+
enable_max_depth: true
127+
128+
.. code-block:: xml
129+
130+
<!-- config/packages/framework.xml -->
131+
<framework:config>
132+
<!-- ... -->
133+
<framework:serializer>
134+
<default-context enable-max-depth="true"/>
135+
</framework:serializer>
136+
</framework:config>
137+
138+
.. code-block:: php
139+
140+
// config/packages/framework.php
141+
use Symfony\Config\FrameworkConfig;
142+
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
143+
144+
return static function (FrameworkConfig $framework) {
145+
$framework->serializer()
146+
->defaultContext([
147+
AbstractObjectNormalizer::ENABLE_MAX_DEPTH => true
148+
])
149+
;
150+
};
151+
152+
.. versionadded:: 5.4
153+
154+
The ability to configure the ``default_context`` option in the
155+
Serializer was introduced in Symfony 5.4.
156+
114157
.. _serializer-using-serialization-groups-annotations:
115158

116159
Using Serialization Groups Annotations

0 commit comments

Comments
 (0)