10000 Merge branch '4.4' into 5.1 · symfony/symfony-docs@c93ebcc · GitHub
[go: up one dir, main page]

Skip to content

Commit c93ebcc

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Correct English word order Update the Snippet with the UserUpgraderInterface replace ExceptionListener by EventListener add caution for datetime object Replace overriding twig.paths by twig.default_path
2 parents 642672b + 7ade60d commit c93ebcc

File tree

5 files changed

+26
-10
lines changed

5 files changed

+26
-10
lines changed

configuration/override_dir_structure.rst

10000 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

mercure.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ And here is the controller::
448448
To use the cookie authentication method, the Symfony app and the Hub
449449
must be served from the same domain (can be different sub-domains).
450450

451-
Generating Programmatically The JWT Used to Publish
451+
Programmatically Generating The JWT Used to Publish
452452
---------------------------------------------------
453453

454454
Instead of directly storing a JWT in the configuration,

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

security/user_provider.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,11 @@ command will generate a nice skeleton to get you started::
360360

361361
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
362362
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
363+
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
363364
use Symfony\Component\Security\Core\User\UserInterface;
364365
use Symfony\Component\Security\Core\User\UserProviderInterface;
365366

366-
class UserProvider implements UserProviderInterface
367+
class UserProvider implements UserProviderInterface, PasswordUpgraderInterface
367368
{
368369
/**
369370
* Symfony calls this method if you use features like switch_user
@@ -416,6 +417,16 @@ command will generate a nice skeleton to get you started::
416417
{
417418
return User::class === $class || is_subclass_of($class, User::class);
418419
}
420+
421+
/**
422+
* Upgrades the encoded password of a user, typically for using a better hash algorithm.
423+
*/
424+
public function upgradePassword(UserInterface $user, string $newEncodedPassword): void
425+
{
426+
// TODO: when encoded passwords are in use, this method should:
427+
// 1. persist the new password in the user storage
428+
// 2. update the $user object with $user->setPassword($newEncodedPassword);
429+
}
419430
}
420431

421432
Most of the work is already done! Read the comments in the code and update the

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)
0