alextartan/doctrine-paginator-ramsey-binary-uuid

An extension of DoctrinePaginator to make it work when ids are binary uuids generated with ramsey/uuid

1.0.3 2020-02-10 14:36 UTC

This package is auto-updated.

Last update: 2024-11-11 01:30:09 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

Build Status Coverage Status Mutation testing badge Scrutinizer Code Quality Downloads

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