Esempio n. 1
0
 /**
  * @param string $email
  * @throws UserAlreadyExistsException
  */
 protected function validateUserDoesNotExists(string $email)
 {
     $userRepository = $this->registry->getRepository(User::class);
     if ($userRepository->findOneBy(['email' => $email]) !== null) {
         throw new UserAlreadyExistsException("User with email '{$email}' already exists.");
     }
 }
 /**
  * @param string $entityName
  * @param array $data
  * @return Screenplay
  */
 public function deserialize($entityName, $data)
 {
     if (!isset($data['id'])) {
         throw new LogicException();
     }
     return $this->registry->getRepository(Screenplay::class)->getReference($data['id']);
 }
Esempio n. 3
0
 /**
  * @inheritdoc
  */
 public function authenticate(array $credentials)
 {
     list($email, $password) = $credentials;
     $email = UserTools::sanitizeUserEmail($email);
     /** @var User|null $user */
     $user = $this->registry->getRepository(User::class)->findOneBy(['email' => $email]);
     if ($user === null) {
         throw new AuthenticationException("User '{$email}' not found.");
     }
     if (!Passwords::verify($password, $user->getPassword())) {
         throw new AuthenticationException('Invalid password.');
     }
     return new Identity($user->getId(), $user->getUserRoles(), ['username' => $user->getEmail()]);
 }
Esempio n. 4
0
 /**
  * @param Client $client
  * @param MappingCreator $mappingCreator
  * @param Registry $registry
  */
 public function __construct(Client $client, MappingCreator $mappingCreator, Registry $registry)
 {
     $this->client = $client;
     $this->mappingCreator = $mappingCreator;
     $this->indicesRepository = $registry->getRepository(Index::class);
     $this->entityManager = $registry->getManager();
 }
Esempio n. 5
0
 /**
  * @todo: wtf? fixme! targetClass?
  * @param \Kdyby\Doctrine\Forms\CollectionContainer $container
  * @param array $values
  */
 public function getCollectionEntry(CollectionContainer $container, $values)
 {
     $parentEntity = $container->getParent()->getData();
     if (!($ids = $this->getValuesIds($parentEntity, $values))) {
         return NULL;
     }
     $entity = $this->doctrine->getRepository(get_class($parentEntity))->find($ids);
     return $container->getCollection()->contains($entity) ? $entity : NULL;
 }
Esempio n. 6
0
 private function getHydrateQuery()
 {
     return $this->registry->getRepository(Screenplay::class)->createQueryBuilder('s')->andWhere('s.id IN(:ids)');
 }
Esempio n. 7
0
 /**
  * @param Registry $registry
  */
 public function __construct(Registry $registry)
 {
     $this->charactersRepository = $registry->getRepository(Character::class);
 }
Esempio n. 8
0
 /**
  * @param int $id
  * @param Registry $registry
  */
 public function __construct($id, Registry $registry)
 {
     parent::__construct();
     $this->screenplay = $registry->getRepository(Screenplay::class)->getReference($id);
 }
Esempio n. 9
0
 /**
  * @return Role[]
  */
 public function getAll() : array
 {
     return $this->registry->getRepository(Role::class)->findAll();
 }
Esempio n. 10
0
 /**
  * @param Client $client
  * @param Registry $registry
  */
 public function __construct(Client $client, Registry $registry)
 {
     $this->client = $client;
     $this->indicesRepository = $registry->getRepository(IndexEntity::class);
     $this->entityManager = $registry->getManager();
 }
Esempio n. 11
0
 /**
  * @param Registry $registry
  */
 public function __construct(Registry $registry)
 {
     $this->languagesRepository = $registry->getRepository(Language::class);
 }