-
-
Notifications
You must be signed in to change notification settings - Fork 454
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
Support for configuring DBAL to use existing connection #335
Comments
+1 for this, I do need it too. |
+1 especially useful for those of us who want to start migrating legacy systems, and need to use some other DBAL (e.g. an old WordPress connection) and would prefer not to double the DB connections each request uses. |
I think you can do it with driver class. When you have done the migration you can fallback to default drivers. On Thu, Sep 1, 2016 at 2:44 AM, Joshua Koudys notifications@github.com
|
Does anybody managed to reuse the mysqli existing connection? |
You can get the mysqli connection handle from dbal if you wish. It is not pretty ofc. Alternative you can write you own driver, as a previous post mentions the easiest way to achieve that is by c/p the existing driver and make your changes, please don't try to extend them, just c/p |
Thank you very much for detailed explanation, I'll try that =) |
Finally I came across a solution like this:
And I can even mix code from my legacy DB::getInstance()->query($sql) with DQL code in a single transaction and commit or roolback the set of mixed queries |
Please dont extend MysqliConnection and etc, C/P into your own project |
Sorry folks not happenning, DBAL is removing this option doctrine/dbal#3554. |
Hi,
DBAL accepts a parameter 'pdo' which allows it to reuse an existing PDO connection:
https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#driver
The Doctrine Bundle however doesn't accept this parameter. Is there any other clean way to make DBAL reuse an existing connection?
Thanks.
The text was updated successfully, but these errors were encountered: