Skip to content

Commit 2f010b7

Browse files
committed
Document the validator's switch to PSR-6.
1 parent 6aaf30e commit 2f010b7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

components/validator/resources.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,21 @@ can slow down your application because each file needs to be parsed, validated
147147
and converted into a :class:`Symfony\\Component\\Validator\\Mapping\\ClassMetadata`
148148
instance.
149149

150-
To solve this problem, call the :method:`Symfony\\Component\\Validator\\ValidatorBuilder::setMetadataCache`
150+
To solve this problem, call the :method:`Symfony\\Component\\Validator\\ValidatorBuilder::setMappingCache`
151151
method of the Validator builder and pass your own caching class (which must
152-
implement :class:`Symfony\\Component\\Validator\\Mapping\\Cache\\CacheInterface`)::
152+
implement the PSR-6 interface :class:`Psr\\Cache\\CacheItemPoolInterface`)::
153153

154154
use Symfony\Component\Validator\Validation;
155155

156156
$validator = Validation::createValidatorBuilder()
157157
// ... add loaders
158-
->setMetadataCache(new SomeImplementCacheInterface());
158+
->setMappingCache(new SomePsr6Cache());
159159
->getValidator();
160160

161+
.. versionadded:: 4.4
162+
163+
Support for PSR-6 compatible mapping caches was introduced in Symfony 4.4.
164+
161165
.. note::
162166

163167
The loaders already use a singleton load mechanism. That means that the

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy