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)); }
/** * @param array $credentials * @return Identity|\Nette\Security\IIdentity * @throws \Nette\Security\AuthenticationException */ public function authenticate(array $credentials) { if ($this->checkConnection->invoke()) { try { /** @var $user \CmsModule\Pages\Users\UserEntity */ $user = $this->userRepository->createQueryBuilder('a')->join('a.loginProviders', 's')->where('s.type = :type AND s.uid = :uid')->setParameter('type', static::getType())->setParameter('uid', $this->getLoginProviderEntity()->getUid())->getQuery()->getSingleResult(); } catch (\Doctrine\ORM\NoResultException $e) { } if (!isset($user) || !$user) { throw new AuthenticationException('User does not exist.', self::INVALID_CREDENTIAL); } return new Identity($user->getId(), $user->getRoles()); } }
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)); }
public function isConnected() { return $this->connectionChecker->invoke(); }