Commit 7cb5143e authored by zYne's avatar zYne

little draft for introducing DI into Doctrine

parent fdf9db40
...@@ -253,6 +253,38 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera ...@@ -253,6 +253,38 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
return $this->connections[$name]; return $this->connections[$name];
} }
/**
* getComponentAlias
* retrieves the alias for given component name
* if the alias couldn't be found, this method returns the given
* component name
*
* @param string $componentName
* @return string the component alias
*/
public function getComponentAlias($componentName)
{
if (isset($this->componentAliases[$componentName])) {
return $this->componentAliases[$componentName];
}
return $componentName;
}
/**
* sets an alias for given component name
* very useful when building a large framework with a possibility
* to override any given class
*
* @param string $componentName the name of the component
* @param string $alias
* @return Doctrine_Manager
*/
public function setComponentAlias($componentName, $alias)
{
$this->componentAliases[$componentName] = $alias;
return $this;
}
/** /**
* bindComponent * bindComponent
* binds given component to given connection * binds given component to given connection
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment