Skip to content

Commit

Permalink
bug #17926 [DependencyInjection] Enable alias for service_container (…
Browse files Browse the repository at this point in the history
…hason)

This PR was merged into the 2.3 branch.

Discussion
----------

[DependencyInjection] Enable alias for service_container

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

6161438 [DependencyInjection] Enabled alias for service_container
  • Loading branch information
fabpot committed Mar 30, 2016
2 parents 3c3e543 + 6161438 commit 39b1642
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Expand Up @@ -42,6 +42,10 @@ public function process(ContainerBuilder $container)
foreach ($container->getAliases() as $id => $alias) {
$aliasId = (string) $alias;

if ('service_container' === $aliasId) {
continue;
}

try {
$definition = $container->getDefinition($aliasId);
} catch (InvalidArgumentException $e) {
Expand Down
Expand Up @@ -34,6 +34,8 @@ public function testProcess()
$container->setAlias('a_alias', 'a');
$container->setAlias('b_alias', 'b');

$container->setAlias('container', 'service_container');

$this->process($container);

$this->assertTrue($container->has('a'), '->process() does nothing to public definitions.');
Expand All @@ -44,6 +46,7 @@ public function testProcess()
'->process() replaces alias to actual.'
);
$this->assertSame('b_alias', $aDefinition->getFactoryService());
$this->assertTrue($container->has('container'));
}

/**
Expand Down

0 comments on commit 39b1642

Please sign in to comment.