Пример #1
0
 /**
  * Register an alias for an identifier
  *
  * @param string $alias      The alias
  * @param mixed  $identifier The class identifier or identifier object
  * @return ObjectManagerInterface
  */
 public function registerAlias($alias, $identifier)
 {
     $alias = trim((string) $alias);
     $identifier = $this->getIdentifier($identifier);
     $this->_registry->alias($alias, $identifier);
     return $this;
 }
Пример #2
0
 /**
  * Set an alias for an identifier
  *
  * @param mixed $identifier An ObjectIdentifier, identifier string or object implementing ObjectInterface
  * @param string $alias     The identifier alias
  * @return ObjectManager
  * @throws ObjectExceptionInvalidIdentifier If the identifier is not valid
  */
 public function registerAlias($identifier, $alias)
 {
     $identifier = $this->getIdentifier($identifier);
     $alias = $this->getIdentifier($alias);
     //Register the alias for the identifier
     $this->__registry->alias($identifier, (string) $alias);
     //Merge alias configuration into the identifier
     $identifier->getConfig()->append($alias->getConfig());
     // Register alias mixins.
     foreach ($alias->getMixins() as $mixin) {
         $this->registerMixin($identifier, $mixin);
     }
     return $this;
 }