Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statement not an instance of ForwardCompatibility\Result #4572

Closed
wizhippo opened this issue Apr 1, 2021 · 6 comments
Closed

Statement not an instance of ForwardCompatibility\Result #4572

wizhippo opened this issue Apr 1, 2021 · 6 comments

Comments

@wizhippo
Copy link

wizhippo commented Apr 1, 2021

Bug Report

Q A
BC Break yes
Version 2.13

Summary

This is odd, after update to 2.13 I am getting

  Argument 1 passed to eZ\Bundle\EzPublishCoreBundle\Command\ReindexCommand::fetchIteration() must implement interface Doctrine\DBAL\Driver\Statement, instance of Doctrine\DBAL\ForwardCompatibility\Result given, called in /var/www/vendor/ezsystems/ezplatform-kernel/eZ/Bundle/Ez  
  PublishCoreBundle/Command/ReindexCommand.php on line 308              

ReindexCommand::fetchIteration() is defined as function fetchIteration(Doctrine\DBAL\Driver\Statement $stmt, $iterationCount)
Statement extends Doctrine\DBAL\Driver\ResultStatement
ForwardCompatibility\Result implements Doctrine\DBAL\Driver\ResultStatement

Why is this thrown if ForwardCompatibility\Result implements ResultStatement and Statement extends ResultStatement?

@beberlei
Copy link
Member

beberlei commented Apr 1, 2021

@wizhippo confusing indeed

@snapshotpl
Copy link
Contributor

Same here

@beberlei
Copy link
Member

beberlei commented Apr 1, 2021

Ok, you are typehinting for Driver\Statement and ForwardCompatibility\Result does not implement that. I am afraid this is a BC break that we introduced in Doctrine DBAL 2.9 in 2018 when we changed the docblock return value for executeQuery to ResultStatement. See https://github.com/doctrine/dbal/pull/3025/files#diff-425f50e688c77962b97e5fd1f9803a6d9ffa9bf260ba12391f73b2aab14914eeR911

It is not something we can fix anymore, you need to change your code and typehint for ResultStatement or disallow DBAL 2.13 for now.

However ResultStatement is also deprecated, in another next step you need to move to using Result.

@beberlei beberlei closed this as completed Apr 1, 2021
@snapshotpl
Copy link
Contributor

@beberlei My mistake. My exception looks similar but looks like not depends on my code, but only internal Doctrine codebase:

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 /app/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php on line 1010

If I'm right, I can open new issue

@snapshotpl
Copy link
Contributor

Ok, looks like fixed now :) doctrine/orm#8575

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants