find($username); // username == $id field if(!$user) { throw new \Symfony\Component\Security\Core\Exception\UsernameNotFoundException("Invalid username"); } return $user; } /** * Refreshes the user for the account interface. * * It is up to the implementation to decide if the user data should be * totally reloaded (e.g. from the database), or if the UserInterface * object can just be merged into some internal array of users / identity * map. * * @param UserInterface $user * * @return UserInterface * * @throws UnsupportedUserException if the account is not supported */ public function refreshUser(UserInterface $user) { $this->_em->refresh($user); } /** * Whether this provider supports the given user class. * * @param string $class * @todo Extending User should be possible * @return bool */ public function supportsClass($class) { return $class == User::class; } // $query = $this->_em->createQuery( // 'SELECT ri FROM ...::class ri WHERE ri.result = :result AND ri.hitAt IS NULL ORDER BY ri.usedPosition ASC' // ) // ->setParameters([ // 'result' => $result, // ]) // ->setMaxResults($limit); // $resultItems = $query->getResult(); }