_em->persist(entity: $entity); if ($flush) { $this->_em->flush(); } } public function remove(User $entity, bool $flush = true): void { $this->_em->remove(entity: $entity); if ($flush) { $this->_em->flush(); } } /** * Used to upgrade (rehash) the user's password automatically over time. */ public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void { if (!$user instanceof User) { throw new UnsupportedUserException(message: sprintf('Instances of "%s" are not supported.', $user::class)); } $user->setPassword(password: $newHashedPassword); $this->_em->persist(entity: $user); $this->_em->flush(); } // /** // * @return User[] Returns an array of User objects // */ /* public function findByExampleField($value) { return $this->createQueryBuilder('u') ->andWhere('u.exampleField = :val') ->setParameter('val', $value) ->orderBy('u.id', 'ASC') ->setMaxResults(10) ->getQuery() ->getResult() ; } */ /* public function findOneBySomeField($value): ?User { return $this->createQueryBuilder('u') ->andWhere('u.exampleField = :val') ->setParameter('val', $value) ->getQuery() ->getOneOrNullResult() ; } */ }