public function handleLoad() { if ($this->backup && $this->connectionCheckerFactory->invoke() && count($this->getEntityManager()->getConnection()->getSchemaManager()->listTables()) == 0) { $this->deploymentManager->loadBackup($this->backup); } $this->redirect('this', array('backup' => NULL)); }
public function handleInstall() { if ($this->connectionCheckerFactory->invoke() && count($this->getEntityManager()->getConnection()->getSchemaManager()->listTables()) == 0) { if ($this->backup) { $this->deploymentManager->loadBackup($this->backup); } else { /** @var $em \Doctrine\ORM\EntityManager */ $em = $this->getEntityManager(); $tool = new SchemaTool($em); $robotLoader = new RobotLoader(); $robotLoader->setCacheStorage(new MemoryStorage()); $robotLoader->addDirectory($this->context->parameters['modules']['cms']['path'] . '/CmsModule'); $robotLoader->register(); $classes = array(); foreach ($robotLoader->getIndexedClasses() as $item => $a) { $ref = ClassType::from($item); if ($ref->hasAnnotation('ORM\\Entity')) { $classes[] = $em->getClassMetadata('\\' . $item); } } $tool->createSchema($classes); /** @var $installer CmsInstaller */ $installer = $this->context->createInstance('CmsModule\\Module\\Installers\\CmsInstaller'); $installer->install($this->context->venne->moduleManager->modules['cms']); } } $this->redirect('Installation:', array('backup' => NULL)); }