Skip to content

Commit 2de840e

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: replace ExceptionListener by EventListener add caution for datetime object Replace overriding twig.paths by twig.default_path
2 parents 957ad9e + 9453d50 commit 2de840e

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

configuration/override_dir_structure.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ Override the Templates Directory
9898
--------------------------------
9999

100100
If your templates are not stored in the default ``templates/`` directory, use
101-
the :ref:`twig.paths <config-twig-paths>` configuration option to define your
102-
own templates directory (or directories):
101+
the :ref:`twig.default_path <config-twig-default-path>` configuration
102+
option to define your own templates directory (use :ref:`twig.paths <config-twig-paths>`
103+
for multiple directories):
103104

104105
.. configuration-block::
105106

@@ -108,7 +109,7 @@ own templates directory (or directories):
108109
# config/packages/twig.yaml
109110
twig:
110111
# ...
111-
paths: ["%kernel.project_dir%/resources/views"]
112+
default_path: "%kernel.project_dir%//resources/views"
112113
113114
.. code-block:: xml
114115
@@ -123,7 +124,7 @@ own templates directory (or directories):
123124
https://symfony.com/schema/dic/twig/twig-1.0.xsd">
124125
125126
<twig:config>
126-
<twig:path>%kernel.project_dir%/resources/views</twig:path>
127+
<twig:default-path>%kernel.project_dir%/resources/views</twig:default-path>
127128
</twig:config>
128129
129130
</container>
@@ -132,9 +133,7 @@ own templates directory (or directories):
132133
133134
// config/packages/twig.php
134135
$container->loadFromExtension('twig', [
135-
'paths' => [
136-
'%kernel.project_dir%/resources/views',
137-
],
136+
'default_path' => '%kernel.project_dir%/resources/views',
138137
]);
139138
140139
Override the Translations Directory

reference/events.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ sent as response::
251251

252252
.. note::
253253

254-
The TwigBundle registers an :class:`Symfony\\Component\\HttpKernel\\EventListener\\ExceptionListener`
254+
The TwigBundle registers an :class:`Symfony\\Component\\HttpKernel\\EventListener\\ErrorListener`
255255
that forwards the ``Request`` to a given controller defined by the
256256
``exception_listener.controller`` parameter.
257257

serializer.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ Custom normalizers and/or encoders can also be loaded by tagging them as
7979
:ref:`serializer.encoder <reference-dic-tags-serializer-encoder>`. It's also
8080
possible to set the priority of the tag in order to decide the matching order.
8181

82+
.. caution::
83+
84+
Always make sure to load the ``DateTimeNormalizer`` when serializing the
85+
``DateTime`` or ``DateTimeImmutable`` classes to avoid excessive memory
86+
usage and exposing internal details.
87+
8288
Here is an example on how to load the
8389
:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`, a
8490
faster alternative to the `ObjectNormalizer` when data objects always use

0 commit comments

Comments
 (0)