-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
DriverManager::getConnection does not accept an existing PDO object as a configuration option. #4504
Comments
Thanks @andrew-demb! I have a use case where my runtime wants to use a PDO from another runtime. Which is (obviously) different from the solution provided in the upgrade document where my runtime tells the other runtime to use the PDO that it is using with Doctrine. Since the other runtime is free to choose their ORM/DBAL vendor provided that it uses a PDO it's more attractive to me to have the other runtime provide the one that it is using. However, even if the other runtime was using Doctrine, it's unclear to me how it would then use the PDO my runtime would provide since that then presents this same problem. As far as I can tell I would have to require the other runtime to use Doctrine (and then share Doctrine specific connections), which is not attractive to me for what I'm trying to accomplish. Are there any current APIs (or plans to create new APIs) to instruct Doctrine to use an existing PDO like in previous versions of DBAL? If not this BC breaking change is pretty significant for me. =/ Regardless, just a friendly reminder that the documentation needs updating. =) Really appreciate the help and all the work put it into Doctrine over the years! Thanks again! |
Same problem here. No |
A solution mentioned here would be to implement your own driver: #3554 |
Fine! I opened a PR to remove this from the docs, but you could have done so yourselves, you know? I mean friendly reminders are great, but friendly PRs are also very much appreciated 😉 |
@greg0ire - lol I didn't really care at all, I had moved on, just wanted y'all to know that you had a c&p error, but I promise not to give you friendly reminders from now on. |
Yes, that's the issue I was pointing at. You got some help with your issue, and didn't think of giving back. Well to be fair, the reminder is still appreciated, just… it feels a bit like piling work on the collective desk. We get a lot of +1, and "me too" and reminders like that. Feels nice to get PRs instead once in a while. So next time, please consider it 🙏 |
wow. "got some help with your issue, and didn't think of giving back"??? - lol I would consider "see upgrade docs" equivalent to the effort of me pointing out that the documentation was incorrect. if your behavior is indicative of the Doctrine community y'all have some cultural problems to work at making better. goodness, dial back the pedantic rhetoric |
You're right, I'm sorry. I could have asked nicely. I guess I got angry because I read another issue right before where several people were complaining that something had not been implemented for years, and they could not fathom how that was even possible. Too much OSS I guess.
Nah that's just me thankfully. |
np, thanks, and being unappreciated feels terrible when you put so much into something, I get it =) thanks for your contributions to OSS, and best of luck in the future |
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. |
Bug Report
Summary
\Doctrine\DBAL\DriverManager::getConnection
does not accept an existing PDO object as a configuration option.I'm not sure if this support was removed in 3.0.0 or if this is a bug. I'm really hoping it's a bug since I won't be able to use 3.0.0 in the case that it's not supported. =)
I think it's a bug since the 3.0.0 documentation is the same API as the 2.x series (or I guess it could be a documentation c&p issue).
Thank you!
Current behaviour
When using
\Doctrine\DBAL\Exception
is thrown with the message "The options 'driver' or 'driverClass' are mandatory if no PDO instance is given to DriverManager::getConnection().".How to reproduce
Execute
Notice that
\Doctrine\DBAL\Exception
is thrown with the message "The options 'driver' or 'driverClass' are mandatory if no PDO instance is given to DriverManager::getConnection().".Expected behaviour
No Throwable is thrown and
DriverManager::getConnection
returns a viable connection. (i.e. it works as it does in 2.12.1)The text was updated successfully, but these errors were encountered: