Skip to content
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

WIP - UUID Docs #201

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down