diff --git a/components/validator/resources.rst b/components/validator/resources.rst index a7cf3678c9d..1455c2518bc 100644 --- a/components/validator/resources.rst +++ b/components/validator/resources.rst @@ -147,17 +147,21 @@ can slow down your application because each file needs to be parsed, validated and converted into a :class:`Symfony\\Component\\Validator\\Mapping\\ClassMetadata` instance. -To solve this problem, call the :method:`Symfony\\Component\\Validator\\ValidatorBuilder::setMetadataCache` +To solve this problem, call the :method:`Symfony\\Component\\Validator\\ValidatorBuilder::setMappingCache` method of the Validator builder and pass your own caching class (which must -implement :class:`Symfony\\Component\\Validator\\Mapping\\Cache\\CacheInterface`):: +implement the PSR-6 interface :class:`Psr\\Cache\\CacheItemPoolInterface`):: use Symfony\Component\Validator\Validation; $validator = Validation::createValidatorBuilder() // ... add loaders - ->setMetadataCache(new SomeImplementCacheInterface()); + ->setMappingCache(new SomePsr6Cache()); ->getValidator(); +.. versionadded:: 4.4 + + Support for PSR-6 compatible mapping caches was introduced in Symfony 4.4. + .. note:: The loaders already use a singleton load mechanism. That means that the
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: