alextartan / doctrine-paginator-ramsey-binary-uuid
An extension of DoctrinePaginator to make it work when ids are binary uuids generated with ramsey/uuid
Installs: 2 566
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.2
- alextartan/helpers: ^2
- doctrine/orm: ^2.6.3
- ramsey/uuid-doctrine: ^1.5
Requires (Dev)
- infection/infection: ^0.13.4
- php-coveralls/php-coveralls: ~2.1
- phpstan/phpstan: ~0.11
- phpstan/phpstan-phpunit: ~0.11
- phpstan/phpstan-strict-rules: ~0.11
- phpunit/phpunit: ^8.0
- roave/security-advisories: dev-master
- squizlabs/php_codesniffer: 3.4.*
This package is auto-updated.
Last update: 2024-10-11 01:17:24 UTC
README
Doctrine's Paginator fails to return objects if their id is of uuid_binary
type.
This happens because the database won't match a BINARY(16)
to a string.
The solution was to get those ids (which were converted by UuidInterface::__toString
)
and return them with UuidInterface::getBytes
. This allows for a proper match at the
database level.
Current build status
Installation
composer require alextartan/doctrine-paginator-ramsey-binary-uuid
Usage
$repo = $this->em->getRepository(SomeEntity::class); $query = $repo->createQueryBuilder('se') ->setMaxResults(2) // more stuff here ->getQuery(); $p = new BinaryUuidSafePaginator($query);
Versioning
This library adheres to semver