From 6992a9e647bb985071bd3574038060b7dfe2072b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 11 Mar 2013 22:43:32 +0100 Subject: [PATCH] [DependencyInjection] fixed id case when setting a service (also slightly enhanced an error message) --- .../Component/DependencyInjection/ContainerBuilder.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index d4a62b8baebd3..abe24647f45fd 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -347,15 +347,15 @@ public function getScopeChildren() */ public function set($id, $service, $scope = self::SCOPE_CONTAINER) { + $id = strtolower($id); + if ($this->isFrozen()) { // setting a synthetic service on a frozen container is alright if (!isset($this->definitions[$id]) || !$this->definitions[$id]->isSynthetic()) { - throw new BadMethodCallException('Setting service on a frozen container is not allowed'); + throw new BadMethodCallException(sprintf('Setting service "%s" on a frozen container is not allowed.', $id)); } } - $id = strtolower($id); - unset($this->definitions[$id], $this->aliases[$id]); parent::set($id, $service, $scope);