src/DB/EntityRepository/User/ResetPasswordRequestRepository.php
<?php

declare(strict_types=1);

namespace App\DB\EntityRepository\User;

use App\DB\Entity\User\ResetPasswordRequest;
use App\DB\Entity\User\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use SymfonyCasts\Bundle\ResetPassword\Model\ResetPasswordRequestInterface;
use SymfonyCasts\Bundle\ResetPassword\Persistence\Repository\ResetPasswordRequestRepositoryTrait;
use SymfonyCasts\Bundle\ResetPassword\Persistence\ResetPasswordRequestRepositoryInterface;

class ResetPasswordRequestRepository extends ServiceEntityRepository implements ResetPasswordRequestRepositoryInterface
{
  use ResetPasswordRequestRepositoryTrait;

  public function __construct(ManagerRegistry $registry)
  {
    parent::__construct($registry, ResetPasswordRequest::class);
  }

  #[\Override]
  public function createResetPasswordRequest(object $user, \DateTimeInterface $expiresAt, string $selector, string $hashedToken): ResetPasswordRequestInterface
  {
    /* @var $user User */
    return new ResetPasswordRequest($user, $expiresAt, $selector, $hashedToken);
  }
}
