-
-
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
Using a user-provided PDO connection breaks assertion #3487
Comments
I think that loosing doesn't address the root issue. Passing a PDO instance is kind of a can of worms that we barely support. There're a couple use cases that I can think of:
I think that the way we implemented is definitely not ideal, IMHO we should rather have an adapter to our interface (that wraps the instance). Now, looking at the future (v3 or v4), maybe we should drop it? |
I've seen this used quite a bit in apps when migrating to Doctrine. They'll have an existing PDO connection open already or some other ORM with a PDO connection. If we don't support it, then they would be forced to have two connections open. I talked to @morozov a few days ago about this and I am going to take a look at properly refactoring this for 3.0. |
What if we just recommend an approach of extending PDO-specific DBAL objects in a project-specific way and maintaining it outside of DBAL. The approach of using DBAL in the applications with existing DB layers is not unique to PDO. E.g. at our company, we use an existing connection with While I do understand the use case, I'd rather help solve it outside the DBAL instead of maintaining a non-portable and not-tested behavior. |
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. |
The following code is expected to work:
On
master
, it currently produces:On
develop
:The existing implementation relies on weak/duck typing since instead of injecting the
PDO
instance intoPDOConnection
, the latter gets replaced. Besides the poor design, this "feature" is completely untested.We can loosen or remove the assertion from
master
but before fixing it indevelop
I'd like to understand the use cases this feature was implemented for.The text was updated successfully, but these errors were encountered: