示例#1
0
 public function configureServiceManager(ServiceManager $serviceManager)
 {
     $allowOverride = $this->getAllowOverride();
     isset($allowOverride) ? $serviceManager->setAllowOverride($allowOverride) : null;
     foreach ($this->getFactories() as $name => $factory) {
         $serviceManager->setFactory($name, $factory);
     }
     foreach ($this->getAbstractFactories() as $factory) {
         $serviceManager->addAbstractFactory($factory);
     }
     foreach ($this->getInvokables() as $name => $invokable) {
         $serviceManager->setInvokableClass($name, $invokable);
     }
     foreach ($this->getServices() as $name => $service) {
         $serviceManager->setService($name, $service);
     }
     foreach ($this->getAliases() as $alias => $nameOrAlias) {
         $serviceManager->setAlias($alias, $nameOrAlias);
     }
     foreach ($this->getInitializers() as $initializer) {
         $serviceManager->addInitializer($initializer);
     }
     foreach ($this->getShared() as $name => $isShared) {
         $serviceManager->setShared($name, $isShared);
     }
 }
示例#2
0
 /**
  * Configure service manager
  *
  * @param ServiceManager $serviceManager
  * @return void
  */
 public function configureServiceManager(ServiceManager $serviceManager)
 {
     if (($allowOverride = $this->getAllowOverride()) !== null) {
         $serviceManager->setAllowOverride($allowOverride);
     }
     foreach ($this->getFactories() as $name => $factory) {
         $serviceManager->setFactory($name, $factory);
     }
     foreach ($this->getAbstractFactories() as $factory) {
         $serviceManager->addAbstractFactory($factory);
     }
     foreach ($this->getInvokables() as $name => $invokable) {
         $serviceManager->setInvokableClass($name, $invokable);
     }
     foreach ($this->getServices() as $name => $service) {
         $serviceManager->setService($name, $service);
     }
     foreach ($this->getAliases() as $alias => $nameOrAlias) {
         $serviceManager->setAlias($alias, $nameOrAlias);
     }
     foreach ($this->getInitializers() as $initializer) {
         $serviceManager->addInitializer($initializer);
     }
     foreach ($this->getShared() as $name => $isShared) {
         $serviceManager->setShared($name, $isShared);
     }
     foreach ($this->getDelegators() as $originalServiceName => $delegators) {
         foreach ($delegators as $delegator) {
             $serviceManager->addDelegator($originalServiceName, $delegator);
         }
     }
 }