You are here

public function ValidatorBuilder::setMetadataCache in Plug 7

Sets the cache for caching class metadata.

Parameters

CacheInterface $cache The cache instance:

Return value

ValidatorBuilderInterface The builder object

Overrides ValidatorBuilderInterface::setMetadataCache

File

lib/Symfony/validator/Symfony/Component/Validator/ValidatorBuilder.php, line 258

Class

ValidatorBuilder
The default implementation of {@link ValidatorBuilderInterface}.

Namespace

Symfony\Component\Validator

Code

public function setMetadataCache(CacheInterface $cache) {
  if (null !== $this->metadataFactory) {
    throw new ValidatorException('You cannot set a custom metadata cache after setting a custom metadata factory. Configure your metadata factory instead.');
  }
  $this->metadataCache = $cache;
  return $this;
}