Exemplo n.º 1
0
 /**
  * Gets the service locator (experimental).
  * @return Nette\IServiceLocator
  */
 public final function getServiceLocator()
 {
     if ($this->serviceLocator === NULL) {
         $this->serviceLocator = new Nette\ServiceLocator(Environment::getServiceLocator());
         foreach ($this->defaultServices as $name => $service) {
             if (!$this->serviceLocator->hasService($name)) {
                 $this->serviceLocator->addService($name, $service);
             }
         }
     }
     return $this->serviceLocator;
 }
Exemplo n.º 2
0
 /**
  * Get initial instance of service locator.
  * @return IServiceLocator
  */
 public function createServiceLocator()
 {
     $locator = new ServiceLocator();
     foreach ($this->defaultServices as $name => $service) {
         $locator->addService($name, $service);
     }
     return $locator;
 }