Find a user by its email
public findUserByEmail ( string $email ) : |
||
string | ||
return | or null if user does not exist |
/** * @param string $email * @param string $pw * @return \FOS\UserBundle\Model\UserInterface|null */ function getUserByEmailPw($email, $pw) { $result = null; if ($email && $pw) { $user = $this->_fosUserManager->findUserByEmail($email); if ($user && $this->isPasswordValid($user, $pw)) { $result = $user; } } return $result; }
/** * @param HookInterface $apiService * @param string $entityName * @return mixed $entityName instance */ public function hydrate(HookInterface $apiService, $entityName) { $hydratedEntity = new $entityName(); if (!$hydratedEntity instanceof HookEventInterface) { throw new LogicException("Can't hydrate this event"); } $hydratedEntity->setEmail($apiService->getEmail()); $hydratedEntity->setName($apiService->getService()); $hydratedEntity->setMetaData($apiService->getMetaData()); $user = $this->userManager->findUserByEmail($apiService->getEmail()); $hydratedEntity->setUser($user); return $hydratedEntity; }
public function findUserByEmail($mail) { return $this->userManager->findUserByEmail($mail); }