/** * 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(); }
/** * 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); } }
/** * returns existing class instance * * @param string $class the class name * * @return mixed */ protected function inject($class) { return $this->objectManager->getInstance($class); }
/** * 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; }
/** * Returns teh SessionHandler instance * * @return DefaultSessionHandler */ protected function getCurrentSessionHandler() { $sessionHandlerClass = $this->manager->getSessionHandler(); $className = self::HANDLER_NAMESPACE . $sessionHandlerClass; return $this->objectManager->getInstance($className); }