-
-
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
Wrap pdo instances #3544
Wrap pdo instances #3544
Conversation
2bcf0f4
to
8970af9
Compare
@@ -189,7 +190,7 @@ public function __construct( | |||
$this->params = $params; | |||
|
|||
if (isset($params['pdo'])) { | |||
$this->_conn = $params['pdo']; | |||
$this->_conn = WrappedPDOConnection::fromInstance($params['pdo']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still would be a breaking change since it's no longer a PDO instance (won't match a type hint, can't call PDO-specific methods, etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not according to our docblocks...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We never expect to handle raw PDO connection in the internals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. I didn't notice it was about the internal API. But still, even if we can afford introducing this class, I don't think we should. Having two PDO connections which share most of the code is not a proper solution. I'd like to propose #3549 instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@morozov I'm fine with not adding this adapter 😄 I'd suggest to port the tests to your PR, just to ensure that the basic stuff works fine.
use function assert; | ||
use function func_get_args; | ||
|
||
final class WrappedPDOConnection implements Connection, ServerInfoAwareConnection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really happy naming-wise and am open for suggestions.
PDOConnectionAdapter
?
Closed as per #3544 (comment) |
Summary
This is an alternative of #3543 created by @alcaeus and @nicolas-grekas.
I'm not really happy naming-wise and am open for suggestions.