Skip to content

ORM toIterable broken due to ForwardCompatibilty result #4588

@bobvandevijver

Description

@bobvandevijver

The following exception occurs when using toIterable on a query generated by a repository query builder:

Argument 1 passed to Doctrine\ORM\Internal\Hydration\AbstractHydrator::toIterable() must implement interface Doctrine\DBAL\Driver\Statement, instance of Doctrine\DBAL\ForwardCompatibility\Result given, called in /var/www/some-project/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php on line 1010

The code line triggering this exception is as follows:

$userIterator = $this->userRepository->createQueryBuilder('u')->getQuery()->toIterable();

This started after upgrading this library from 1.12.1 to 1.13.0. It looks like the following line is the cause of this:

return $this->ensureForwardCompatibilityStatement($stmt);

Which triggers the exception finally in ORM in the AbstractQuery, where the toIterable doesn't receive the statement object it expects.

For me it looks like the ForwardCompatibilty isn't fully compatible with the statement object returned previously, so it would seem to be it needs to be fixed here? If that is not the case and this issue needs to be opened on the ORM repository, just say the word!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions