| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- declare(strict_types=1);
- namespace App\Repository\Person;
- use App\Entity\Person\Person;
- use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
- use Doctrine\Persistence\ManagerRegistry;
- use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
- use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
- use Symfony\Component\Security\Core\User\UserInterface;
- /**
- * @method Person|null find($id, $lockMode = null, $lockVersion = null)
- * @method Person|null findOneBy(array $criteria, array $orderBy = null)
- * @method Person[] findAll()
- * @method Person[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
- */
- final class PersonRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
- {
- public function __construct(ManagerRegistry $registry)
- {
- parent::__construct($registry, Person::class);
- }
- /**
- * Used to upgrade (rehash) the user's password automatically over time.
- */
- public function upgradePassword(UserInterface $user, string $newEncodedPassword): void
- {
- if (!$user instanceof Person) {
- throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
- }
- $user->setPassword($newEncodedPassword);
- $this->_em->persist($user);
- $this->_em->flush();
- }
- // /**
- // * @return Person[] Returns an array of Person objects
- // */
- /*
- public function findByExampleField($value)
- {
- return $this->createQueryBuilder('p')
- ->andWhere('p.exampleField = :val')
- ->setParameter('val', $value)
- ->orderBy('p.id', 'ASC')
- ->setMaxResults(10)
- ->getQuery()
- ->getResult()
- ;
- }
- */
- /*
- public function findOneBySomeField($value): ?Person
- {
- return $this->createQueryBuilder('p')
- ->andWhere('p.exampleField = :val')
- ->setParameter('val', $value)
- ->getQuery()
- ->getOneOrNullResult()
- ;
- }
- */
- }
|