/** * @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']); }
/** * @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()]); }
/** * @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(); }
/** * @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; }
private function getHydrateQuery() { return $this->registry->getRepository(Screenplay::class)->createQueryBuilder('s')->andWhere('s.id IN(:ids)'); }
/** * @param Registry $registry */ public function __construct(Registry $registry) { $this->charactersRepository = $registry->getRepository(Character::class); }
/** * @param int $id * @param Registry $registry */ public function __construct($id, Registry $registry) { parent::__construct(); $this->screenplay = $registry->getRepository(Screenplay::class)->getReference($id); }
/** * @return Role[] */ public function getAll() : array { return $this->registry->getRepository(Role::class)->findAll(); }
/** * @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(); }
/** * @param Registry $registry */ public function __construct(Registry $registry) { $this->languagesRepository = $registry->getRepository(Language::class); }