From 60f5210caab0a1880ed8aa0bb6c0114cc3d1715b Mon Sep 17 00:00:00 2001 From: Jesse Rushlow Date: Mon, 13 Dec 2021 10:32:39 -0500 Subject: [PATCH] WIP - UUID Docs --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 7efd1597..aba54993 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,36 @@ _Optional_ - Defaults to `true` Enable or disable the Reset Password Cleaner which handles expired reset password requests that may have been left in persistence. +## Symfony UID Support + +If you're implementing [Symfony's UID Component](https://symfony.com/doc/current/components/uid.html) to use UUID/ULID's for the `ResetPasswordRequest` entity that is generated by Maker Bundle - you'll also +need to modify the `ResetPasswordRequestRepositoryTrait` to handle the DQL queries by adding the 3rd argument to `setParameter`. + +```diff +trait ResetPasswordRequestRepositoryTrait +{ + public function removeResetPasswordRequest(ResetPasswordRequestInterface $resetPasswordRequest): void + { + $this->createQueryBuilder('t') + ->delete() + ->where('t.user = :user') +- ->setParameter('user', $resetPasswordRequest->getUser()) ++ ->setParameter('user', $resetPasswordRequest->getUser()->getId(), 'uuid') + ->getQuery() + ->execute() + ; + } +} +``` + +In the example above, rather than passing the user object as the parameter value +in the query builder, we are passing the users `Uuid` instance as the +parameter value and specifying the parameter type as `uuid`. If you were using +ULID's rather than UUID's, you would set the 3rd argument to 'ulid'. + +More information about storing UUIDs in the database can be found in the Symfony + UID Components [Documentation](https://symfony.com/doc/current/components/uid.html#storing-uuids-in-databases) + ## Support Feel free to open an issue for questions, problems, or suggestions with our bundle.