Update src/Symfony/Component/Validator/Mapping/ClassMetadataFactory.php
This commit is contained in:
parent
91e977d38c
commit
99406eb761
@ -45,35 +45,6 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
|
||||
{
|
||||
$class = ltrim($class, '\\');
|
||||
|
||||
if (!isset($this->loadedClasses[$class])) {
|
||||
if ($this->cache !== null && $this->cache->has($class)) {
|
||||
$this->loadedClasses[$class] = $this->cache->read($class);
|
||||
} else {
|
||||
$metadata = new ClassMetadata($class);
|
||||
|
||||
// Include constraints from the parent class
|
||||
if ($parent = $metadata->getReflectionClass()->getParentClass()) {
|
||||
$metadata->mergeConstraints($this->getClassMetadata($parent->getName()));
|
||||
}
|
||||
|
||||
// Include constraints from all implemented interfaces
|
||||
foreach ($metadata->getReflectionClass()->getInterfaces() as $interface) {
|
||||
if ('Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->getName()) {
|
||||
continue;
|
||||
}
|
||||
$metadata->mergeConstraints($this->getClassMetadata($interface->getName()));
|
||||
}
|
||||
|
||||
$this->loader->loadClassMetadata($metadata);
|
||||
|
||||
$this->loadedClasses[$class] = $metadata;
|
||||
|
||||
if ($this->cache !== null) {
|
||||
$this->cache->write($metadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (null !== $this->cache && false !== ($this->loadedClasses[$class] = $this->cache->read($class))) {
|
||||
return $this->loadedClasses[$class];
|
||||
}
|
||||
@ -87,6 +58,9 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
|
||||
|
||||
// Include constraints from all implemented interfaces
|
||||
foreach ($metadata->getReflectionClass()->getInterfaces() as $interface) {
|
||||
if ('Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->getName()) {
|
||||
continue;
|
||||
}
|
||||
$metadata->mergeConstraints($this->getClassMetadata($interface->getName()));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user