Пример #1
0
 /**
  * alternative constructor
  *
  * @return void
  *
  * @throws \Exception
  */
 public function init()
 {
     // inject classes
     $this->manager = $this->objectManager->getInstance('\\Noa\\Interfaces\\ConfigurationManagerInterface');
     $this->request = $this->objectManager->getInstance('\\Noa\\Core\\Http\\Request');
     $this->response = $this->objectManager->getInstance('\\Noa\\Core\\Http\\Response');
     $this->sessionPath = $this->manager->getSessionPath();
 }
Пример #2
0
 /**
  * creates a entity manager instance if database settings are given
  *
  * @return void
  */
 protected function createEntityManager()
 {
     // @TODO enhance error handling
     if ($connectionParameters = $this->manager->getDatabase()) {
         $metadataConfiguration = Setup::createAnnotationMetadataConfiguration(array(NOA_MODEL_DIR), true);
         $entityManger = EntityManager::create($connectionParameters, $metadataConfiguration);
         // persists entity manager into the object manager
         $this->objectManager->set($entityManger);
     }
 }
Пример #3
0
 /**
  * returns existing class instance
  *
  * @param string $class the class name
  *
  * @return mixed
  */
 protected function inject($class)
 {
     return $this->objectManager->getInstance($class);
 }
Пример #4
0
 /**
  * returns existing class instance
  *
  * @param string $class     the class name
  * @param array  $arguments optional class arguments
  *
  * @return mixed
  */
 protected function inject($class, $arguments = array())
 {
     $class = $this->objectManager->getInstance($class);
     return $class;
 }
Пример #5
0
 /**
  * Returns teh SessionHandler instance
  *
  * @return DefaultSessionHandler
  */
 protected function getCurrentSessionHandler()
 {
     $sessionHandlerClass = $this->manager->getSessionHandler();
     $className = self::HANDLER_NAMESPACE . $sessionHandlerClass;
     return $this->objectManager->getInstance($className);
 }