8000 Paginator breaks when DQL query is re-used with different identifier parameters that require conversion · Issue #7837 · doctrine/orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Paginator breaks when DQL query is re-used with different identifier parameters that require conversion #7837
Closed
@Ocramius

Description

@Ocramius

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0