-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UUID and ULID support #171
Comments
Hi, It seems the trait I have to override 2 trait methods to do them work: class ResetPasswordRequestRepository extends ServiceEntityRepository implements ResetPasswordRequestRepositoryInterface
{
use ResetPasswordRequestRepositoryTrait;
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, ResetPasswordRequest::class);
}
/**
* @param User $user
*/
public function createResetPasswordRequest(
object $user,
DateTimeInterface $expiresAt,
string $selector,
string $hashedToken
): ResetPasswordRequestInterface {
return new ResetPasswordRequest($user, $expiresAt, $selector, $hashedToken);
}
/**
* Override trait method because of using ulid for user ID.
*
* @param User $user
*/
public function getMostRecentNonExpiredRequestDate(object $user): ?DateTimeInterface
{
// Normally there is only 1 max request per use, but written to be flexible
/** @var ResetPasswordRequestInterface $resetPasswordRequest */
$resetPasswordRequest = $this->createQueryBuilder('t')
->where('t.user = :user')
->setParameter('user', $user->getId(), 'ulid')
->orderBy('t.requestedAt', 'DESC')
->setMaxResults(1)
->getQuery()
->getOneorNullResult()
;
if (null !== $resetPasswordRequest && !$resetPasswordRequest->isExpired()) {
return $resetPasswordRequest->getRequestedAt();
}
return null;
}
/**
* Override trait method because of using ulid for user ID.
*/
public function removeResetPasswordRequest(ResetPasswordRequestInterface $resetPasswordRequest): void
{
/** @var User $user */
$user = $resetPasswordRequest->getUser();
$this->createQueryBuilder('t')
->delete()
->where('t.user = :user')
->setParameter('user', $user->getId(), 'ulid')
->getQuery()
->execute()
;
}
} Did I have another solution? Thanks a lot, Mickaël |
Hi, @jrushlow, @weaverryan, does this issue deserve to be reopened? Thanks a lot, Mickaël |
Hi, I have created this new issue: #198. |
Hi,
It's a great and useful bundle!
Have you plan to support UUID and ULID type of User ID ?
Kind regards
The text was updated successfully, but these errors were encountered: