Description
Bug Report
Q | A |
---|---|
BC Break | no |
Version | 2.6.4 |
Summary
#7820 and #7821 fix pagination issues happening when the paginator is relying on identifiers that require custom DBAL type conversion.
The type conversion works, but since it has been performed inside the WhereInWalker
(to keep things a bit simpler), it is only performed when the query is in Doctrine\ORM\Query::STATE_DIRTY
.
If the parameters are changed on a Doctrine\ORM\Query
, the query doesn't change parser state, and therefore the WhereInWalker
is completely skipped.
I will try to write a small reproducer and fix ASAP, hoping to not cause too big performance regressions in the ORM. I think it may come down to forcing query parsing to be repeated.
Current behavior
$id = generateCustomId();
$a = new A($id);
$this->em->persist($a);
$this->em->flush();
$query = $this->em->createQuery('SELECT a FROM ' . A::class);
$paginator = new Paginator($query);
$query->setFirstResult(1);
Assert::count(0, \iterator_to_array($paginator));
$query->setFirstResult(0);
Assert::same([$a], \iterator_to_array($paginator));
Expected behavior
The last assertion in the test above fails: this is an unfortunate case of mutable state shared inside Doctrine\ORM\Query
.