|
@@ -181,6 +181,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|
|
throw new \BadMethodCallException('Setting service on a frozen container is not allowed');
|
|
|
}
|
|
|
|
|
|
+ $id = strtolower($id);
|
|
|
+
|
|
|
unset($this->definitions[$id], $this->aliases[$id]);
|
|
|
|
|
|
parent::set($id, $service);
|
|
@@ -193,7 +195,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|
|
*/
|
|
|
public function remove($id)
|
|
|
{
|
|
|
- unset($this->definitions[$id]);
|
|
|
+ unset($this->definitions[strtolower($id)]);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -205,6 +207,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|
|
*/
|
|
|
public function has($id)
|
|
|
{
|
|
|
+ $id = strtolower($id);
|
|
|
+
|
|
|
return isset($this->definitions[$id]) || isset($this->aliases[$id]) || parent::has($id);
|
|
|
}
|
|
|
|
|
@@ -223,6 +227,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|
|
*/
|
|
|
public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
|
|
|
{
|
|
|
+ $id = strtolower($id);
|
|
|
+
|
|
|
try {
|
|
|
return parent::get($id, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE);
|
|
|
} catch (\InvalidArgumentException $e) {
|
|
@@ -377,6 +383,9 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|
|
*/
|
|
|
public function setAlias($alias, $id)
|
|
|
{
|
|
|
+ $alias = strtolower($alias);
|
|
|
+ $id = strtolower($id);
|
|
|
+
|
|
|
unset($this->definitions[$alias]);
|
|
|
|
|
|
$this->aliases[$alias] = $id;
|
|
@@ -389,7 +398,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|
|
*/
|
|
|
public function removeAlias($alias)
|
|
|
{
|
|
|
- unset($this->aliases[$alias]);
|
|
|
+ unset($this->aliases[strtolower($alias)]);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -401,7 +410,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|
|
*/
|
|
|
public function hasAlias($id)
|
|
|
{
|
|
|
- return array_key_exists($id, $this->aliases);
|
|
|
+ return array_key_exists(strtolower($id), $this->aliases);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -425,6 +434,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|
|
*/
|
|
|
public function getAlias($id)
|
|
|
{
|
|
|
+ $id = strtolower($id);
|
|
|
+
|
|
|
if (!$this->hasAlias($id)) {
|
|
|
throw new \InvalidArgumentException(sprintf('The service alias "%s" does not exist.', $id));
|
|
|
}
|
|
@@ -478,7 +489,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|
|
*/
|
|
|
public function register($id, $class = null)
|
|
|
{
|
|
|
- return $this->setDefinition($id, new Definition($class));
|
|
|
+ return $this->setDefinition(strtolower($id), new Definition($class));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -528,6 +539,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|
|
throw new \BadMethodCallException('Adding definition to a frozen container is not allowed');
|
|
|
}
|
|
|
|
|
|
+ $id = strtolower($id);
|
|
|
+
|
|
|
unset($this->aliases[$id]);
|
|
|
|
|
|
return $this->definitions[$id] = $definition;
|
|
@@ -542,7 +555,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|
|
*/
|
|
|
public function hasDefinition($id)
|
|
|
{
|
|
|
- return array_key_exists($id, $this->definitions);
|
|
|
+ return array_key_exists(strtolower($id), $this->definitions);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -556,6 +569,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|
|
*/
|
|
|
public function getDefinition($id)
|
|
|
{
|
|
|
+ $id = strtolower($id);
|
|
|
+
|
|
|
if (!$this->hasDefinition($id)) {
|
|
|
throw new \InvalidArgumentException(sprintf('The service definition "%s" does not exist.', $id));
|
|
|
}
|
|
@@ -576,6 +591,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|
|
*/
|
|
|
public function findDefinition($id)
|
|
|
{
|
|
|
+ $id = strtolower($id);
|
|
|
+
|
|
|
if ($this->hasAlias($id)) {
|
|
|
return $this->findDefinition($this->getAlias($id));
|
|
|
}
|
|
@@ -620,7 +637,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|
|
}
|
|
|
|
|
|
if ($definition->isShared()) {
|
|
|
- $this->services[$id] = $service;
|
|
|
+ $this->services[strtolower($id)] = $service;
|
|
|
}
|
|
|
|
|
|
foreach ($definition->getMethodCalls() as $call) {
|