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

Create Connection from existing PDO instance #5250

Closed
oojacoboo opened this issue Feb 6, 2022 · 3 comments
Closed

Create Connection from existing PDO instance #5250

oojacoboo opened this issue Feb 6, 2022 · 3 comments

Comments

@oojacoboo
Copy link

oojacoboo commented Feb 6, 2022

BC Break Report

Prior to version 3, you could set the pdo property of the Doctrine\DBAL\Connection params. This allowed for you to reuse a PDO connection object.

Q A
BC Break yes
Version 3.3

Summary

The issue here is that you no longer have a way to reuse a connection with Doctrine. I guess the idea now is that you should initialize your PDO connection with Doctrine, then use the new getNativeConnection method.

Please reference this ticket as well: #4603.

Even if you overload the _conn property via reflection, you're still left with the error mentioned in this ticket.

SQLSTATE[HY000]: General error: user-supplied statement class must be derived from PDOStatement

The Doctrine\DBAL\Driver\PDO\Statement class doesn't extend PDOStatement.

@greg0ire
Copy link
Member

greg0ire commented Feb 6, 2022

Prior to version 3

Not meant as a critic, but as a hint to other readers: I was looking at the 3.3.0 changelog in order to find where we did that BC-break and then I noticed that you're reporting a BC-break:

  • for a major version;
  • that is already documented.

I think it really is a good thing that we merged #5247 because it will make people more likely to pick "support question" for that kind of case.

Also for other readers: here is the PR where we deprecated doing this: #3554

That PR mentions another fix:

Another fix for 2 is to implement your own Driver that is created with an existing PDO instance.

Does this help?

@oojacoboo
Copy link
Author

@greg0ire thanks for some supporting documentation on this. There wasn't much out there about this topic, so I created a ticket. It wasn't clear that this was an intentional deprecation and not a BC break. I'm not happy about it and disagree with how it's done, but I digress. Closing this, hopefully it's helpful to others with the same issue.

@morozov morozov closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2022
@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 Aug 15, 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