/** * Starts database connection using parameters configured at zeus.json * or the EntityManager object * @param EntityManager $em An externally configured EntityManager object */ protected function __construct($em = null) { if (is_null($em)) { $zConf = Configuration::getInstance(); if (!is_null($zConf->getDatabase())) { $ormConfig = Setup::createAnnotationMetadataConfiguration(array($zConf->getInitialDirectory()), $zConf->inDevelopment()); $this->entityManager = EntityManager::create(array('host' => $zConf->getDatabase()->host, 'driver' => $zConf->getDatabase()->driver, 'user' => $zConf->getDatabase()->username, 'password' => $zConf->getDatabase()->password, 'dbname' => $zConf->getDatabase()->dbname), $ormConfig); } } else { $this->entityManager = $em; } }
/** * Returns all classes information inside Zeus initial directory * configured at zeus.json * @return \Saxulum\AnnotationManager\Helper\ClassInfo */ private function getAllClasses() { $annotationReader = new SimpleAnnotationReader(); $annotationManager = new AnnotationManager($annotationReader); $zConf = Configuration::getInstance(); return $annotationManager->buildClassInfosBasedOnPath($zConf->getInitialDirectory()); }