Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
|
@ -45,7 +45,7 @@ class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface
|
|||
try {
|
||||
$definition = $container->getDefinition($aliasId);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
throw new InvalidArgumentException(sprintf('Unable to replace alias "%s" with "%s".', $alias, $id), null, $e);
|
||||
throw new InvalidArgumentException(sprintf('Unable to replace alias "%s" with actual definition "%s".', $id, $alias), null, $e);
|
||||
}
|
||||
|
||||
if ($definition->isPublic()) {
|
||||
|
@ -95,6 +95,9 @@ class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface
|
|||
$definition->setProperties(
|
||||
$this->updateArgumentReferences($definition->getProperties(), $currentId, $newId)
|
||||
);
|
||||
|
||||
$definition->setFactoryService($this->updateFactoryServiceReference($definition->getFactoryService(false), $currentId, $newId), false);
|
||||
$definition->setFactory($this->updateFactoryReference($definition->getFactory(), $currentId, $newId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,4 +125,26 @@ class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface
|
|||
|
||||
return $arguments;
|
||||
}
|
||||
|
||||
private function updateFactoryServiceReference($factoryService, $currentId, $newId)
|
||||
{
|
||||
if (null === $factoryService) {
|
||||
return;
|
||||
}
|
||||
|
||||
return $currentId === $factoryService ? $newId : $factoryService;
|
||||
}
|
||||
|
||||
private function updateFactoryReference($factory, $currentId, $newId)
|
||||
{
|
||||
if (null === $factory || !is_array($factory) || !$factory[0] instanceof Reference) {
|
||||
return $factory;
|
||||
}
|
||||
|
||||
if ($currentId === (string) $factory[0]) {
|
||||
$factory[0] = new Reference($newId, $factory[0]->getInvalidBehavior());
|
||||
}
|
||||
|
||||
return $factory;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue