[DependencyInjection] fix merge
Remove code from bugfix that deals with features removed in Symfony 3.0.
This commit is contained in:
parent
f204104c3b
commit
5b30cb7371
@ -44,10 +44,6 @@ class ResolveReferencesToAliasesPass implements CompilerPassInterface
|
|||||||
$definition->setMethodCalls($this->processArguments($definition->getMethodCalls()));
|
$definition->setMethodCalls($this->processArguments($definition->getMethodCalls()));
|
||||||
$definition->setProperties($this->processArguments($definition->getProperties()));
|
$definition->setProperties($this->processArguments($definition->getProperties()));
|
||||||
$definition->setFactory($this->processFactory($definition->getFactory()));
|
$definition->setFactory($this->processFactory($definition->getFactory()));
|
||||||
|
|
||||||
if (null !== $factoryService = $definition->getFactoryService(false)) {
|
|
||||||
$definition->setFactoryService($this->processFactoryService($factoryService));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($container->getAliases() as $id => $alias) {
|
foreach ($container->getAliases() as $id => $alias) {
|
||||||
@ -82,15 +78,6 @@ class ResolveReferencesToAliasesPass implements CompilerPassInterface
|
|||||||
return $arguments;
|
return $arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function processFactoryService($factoryService)
|
|
||||||
{
|
|
||||||
if (null === $factoryService) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->getDefinitionId($factoryService);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function processFactory($factory)
|
private function processFactory($factory)
|
||||||
{
|
{
|
||||||
if (null === $factory || !is_array($factory) || !$factory[0] instanceof Reference) {
|
if (null === $factory || !is_array($factory) || !$factory[0] instanceof Reference) {
|
||||||
@ -100,7 +87,7 @@ class ResolveReferencesToAliasesPass implements CompilerPassInterface
|
|||||||
$defId = $this->getDefinitionId($id = (string) $factory[0]);
|
$defId = $this->getDefinitionId($id = (string) $factory[0]);
|
||||||
|
|
||||||
if ($defId !== $id) {
|
if ($defId !== $id) {
|
||||||
$factory[0] = new Reference($defId, $factory[0]->getInvalidBehavior(), $factory[0]->isStrict(false));
|
$factory[0] = new Reference($defId, $factory[0]->getInvalidBehavior());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $factory;
|
return $factory;
|
||||||
|
@ -82,24 +82,6 @@ class ResolveReferencesToAliasesPassTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertSame('Factory', (string) $resolvedBarFactory[0]);
|
$this->assertSame('Factory', (string) $resolvedBarFactory[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @group legacy
|
|
||||||
*/
|
|
||||||
public function testResolveFactoryService()
|
|
||||||
{
|
|
||||||
$container = new ContainerBuilder();
|
|
||||||
$container->register('factory', 'Factory');
|
|
||||||
$container->setAlias('factory_alias', new Alias('factory'));
|
|
||||||
$foo = new Definition();
|
|
||||||
$foo->setFactoryService('factory_alias');
|
|
||||||
$foo->setFactoryMethod('createFoo');
|
|
||||||
$container->setDefinition('foo', $foo);
|
|
||||||
|
|
||||||
$this->process($container);
|
|
||||||
|
|
||||||
$this->assertSame('factory', $foo->getFactoryService());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function process(ContainerBuilder $container)
|
protected function process(ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
$pass = new ResolveReferencesToAliasesPass();
|
$pass = new ResolveReferencesToAliasesPass();
|
||||||
|
Reference in New Issue
Block a user