Skip to content

Commit c49a38b

Browse files
committed
minor #12276 Document the validator's switch to PSR-6 (derrabus)
This PR was merged into the 4.4 branch. Discussion ---------- Document the validator's switch to PSR-6 This PR documents symfony/symfony#33459 and fixes #12275. Commits ------- 2f010b7 Document the validator's switch to PSR-6.
2 parents f04a541 + 2f010b7 commit c49a38b

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)