Update to Drupal 8.2.6. For more information, see https://www.drupal.org/project/drupal/releases/8.2.6

This commit is contained in:
Pantheon Automation 2017-02-02 16:28:38 -08:00 committed by Greg Anderson
parent db56c09587
commit f1e72395cb
588 changed files with 26857 additions and 2777 deletions

View file

@ -101,8 +101,11 @@ class LazyLoadingMetadataFactory implements MetadataFactoryInterface
return $this->loadedClasses[$class];
}
if (null !== $this->cache && false !== ($this->loadedClasses[$class] = $this->cache->read($class))) {
return $this->loadedClasses[$class];
if (null !== $this->cache && false !== ($metadata = $this->cache->read($class))) {
// Include constraints from the parent class
$this->mergeConstraints($metadata);
return $this->loadedClasses[$class] = $metadata;
}
if (!class_exists($class) && !interface_exists($class)) {
@ -111,19 +114,6 @@ class LazyLoadingMetadataFactory implements MetadataFactoryInterface
$metadata = new ClassMetadata($class);
// Include constraints from the parent class
if ($parent = $metadata->getReflectionClass()->getParentClass()) {
$metadata->mergeConstraints($this->getMetadataFor($parent->name));
}
// Include constraints from all implemented interfaces
foreach ($metadata->getReflectionClass()->getInterfaces() as $interface) {
if ('Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->name) {
continue;
}
$metadata->mergeConstraints($this->getMetadataFor($interface->name));
}
if (null !== $this->loader) {
$this->loader->loadClassMetadata($metadata);
}
@ -132,9 +122,46 @@ class LazyLoadingMetadataFactory implements MetadataFactoryInterface
$this->cache->write($metadata);
}
// Include constraints from the parent class
$this->mergeConstraints($metadata);
return $this->loadedClasses[$class] = $metadata;
}
private function mergeConstraints(ClassMetadata $metadata)
{
// Include constraints from the parent class
if ($parent = $metadata->getReflectionClass()->getParentClass()) {
$metadata->mergeConstraints($this->getMetadataFor($parent->name));
}
$interfaces = $metadata->getReflectionClass()->getInterfaces();
$interfaces = array_filter($interfaces, function ($interface) use ($parent, $interfaces) {
$interfaceName = $interface->getName();
if ($parent && $parent->implementsInterface($interfaceName)) {
return false;
}
foreach ($interfaces as $i) {
if ($i !== $interface && $i->implementsInterface($interfaceName)) {
return false;
}
}
return true;
});
// Include constraints from all directly implemented interfaces
foreach ($interfaces as $interface) {
if ('Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->name) {
continue;
}
$metadata->mergeConstraints($this->getMetadataFor($interface->name));
}
}
/**
* {@inheritdoc}
*/

View file

@ -16,8 +16,6 @@ use Symfony\Component\Validator\MetadataFactoryInterface as LegacyMetadataFactor
/**
* Returns {@link \Symfony\Component\Validator\Mapping\MetadataInterface} instances for values.
*
* @since 2.5
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface MetadataFactoryInterface extends LegacyMetadataFactoryInterface