Enables annotation based constraint mapping.
Reader $annotationReader The annotation reader to be used.:
ValidatorBuilderInterface The builder object.
Overrides ValidatorBuilderInterface::enableAnnotationMapping
public function enableAnnotationMapping(Reader $annotationReader = null) {
if (null !== $this->metadataFactory) {
throw new ValidatorException('You cannot enable annotation mapping after setting a custom metadata factory. Configure your metadata factory instead.');
}
if (null === $annotationReader) {
if (!class_exists('Doctrine\\Common\\Annotations\\AnnotationReader')) {
throw new \RuntimeException('Requested a ValidatorFactory with an AnnotationLoader, but the AnnotationReader was not found. You should add Doctrine Common to your project.');
}
$annotationReader = new CachedReader(new AnnotationReader(), new ArrayCache());
}
$this->annotationReader = $annotationReader;
return $this;
}