Skip to content

Commit 9453d50

Browse files
committed
Merge branch '3.4' into 4.4
* 3.4: add caution for datetime object Replace overriding twig.paths by twig.default_path
2 parents 80fad6d + 5016771 commit 9453d50

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
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

serializer.rst

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

94+
.. caution::
95+
96+
Always make sure to load the ``DateTimeNormalizer`` when serializing the
97+
``DateTime`` or ``DateTimeImmutable`` classes to avoid excessive memory
98+
usage and exposing internal details.
99+
94100
Here is an example on how to load the
95101
:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`, a
96102
faster alternative to the `ObjectNormalizer` when data objects always use

0 commit comments

Comments
 (0)