From bb797ee75591f8461dbcc6fdc8a50b5d3aa8fe5a Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 4 Jun 2013 14:31:04 +0200 Subject: [PATCH] [DependencyInjection] Remove get*Alias*Service methods from compiled containers --- .../DependencyInjection/Dumper/PhpDumper.php | 43 +------------------ .../Tests/Fixtures/php/services9.php | 10 ----- .../Tests/Fixtures/php/services9_compiled.php | 10 ----- 3 files changed, 2 insertions(+), 61 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 0dd058e9ab..c1c8da193f 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -594,39 +594,6 @@ EOF; return $code; } - /** - * Adds a service alias. - * - * @param string $alias - * @param string $id - * - * @return string - */ - private function addServiceAlias($alias, $id) - { - $name = Container::camelize($alias); - $type = 'Object'; - - if ($this->container->hasDefinition($id)) { - $class = $this->container->getDefinition($id)->getClass(); - $type = 0 === strpos($class, '%') ? 'Object' : $class; - } - - return <<getServiceCall($id)}; - } - -EOF; - } - /** * Adds multiple services * @@ -634,7 +601,7 @@ EOF; */ private function addServices() { - $publicServices = $privateServices = $aliasServices = $synchronizers = ''; + $publicServices = $privateServices = $synchronizers = ''; $definitions = $this->container->getDefinitions(); ksort($definitions); foreach ($definitions as $id => $definition) { @@ -647,13 +614,7 @@ EOF; $synchronizers .= $this->addServiceSynchronizer($id, $definition); } - $aliases = $this->container->getAliases(); - ksort($aliases); - foreach ($aliases as $alias => $id) { - $aliasServices .= $this->addServiceAlias($alias, $id); - } - - return $publicServices.$aliasServices.$synchronizers.$privateServices; + return $publicServices.$synchronizers.$privateServices; } /** diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php index 0840ee8843..5929351e43 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php @@ -214,16 +214,6 @@ class ProjectServiceContainer extends Container throw new RuntimeException('You have requested a synthetic service ("request"). The DIC does not know how to construct this service.'); } - /** - * Gets the alias_for_foo service alias. - * - * @return FooClass An instance of the foo service - */ - protected function getAliasForFooService() - { - return $this->get('foo'); - } - /** * Updates the 'request' service. */ diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index b81c4953e6..4170ad1f30 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -219,16 +219,6 @@ class ProjectServiceContainer extends Container throw new RuntimeException('You have requested a synthetic service ("request"). The DIC does not know how to construct this service.'); } - /** - * Gets the alias_for_foo service alias. - * - * @return FooClass An instance of the foo service - */ - protected function getAliasForFooService() - { - return $this->get('foo'); - } - /** * Updates the 'request' service. */