Skip to content

Wrap pdo instances#3544

Closed
lcobucci wants to merge 4 commits intodoctrine:masterfrom
lcobucci:wrap-pdo-instances
Closed

Wrap pdo instances#3544
lcobucci wants to merge 4 commits intodoctrine:masterfrom
lcobucci:wrap-pdo-instances

Conversation

@lcobucci
Copy link
Copy Markdown
Member

Q A
Type improvement
BC Break no (based on our doc blocks)
Related issues #3487

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.

@lcobucci lcobucci added this to the 2.10.0 milestone May 10, 2019
@lcobucci lcobucci requested review from alcaeus and morozov May 10, 2019 21:33

if (isset($params['pdo'])) {
$this->_conn = $params['pdo'];
$this->_conn = WrappedPDOConnection::fromInstance($params['pdo']);
Copy link
Copy Markdown
Member

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).

Copy link
Copy Markdown
Member Author

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...

Copy link
Copy Markdown
Member Author

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

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member Author

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
Copy link
Copy Markdown
Member

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?

@lcobucci
Copy link
Copy Markdown
Member Author

Closed as per #3544 (comment)

@lcobucci lcobucci closed this May 22, 2019
@lcobucci lcobucci deleted the wrap-pdo-instances branch May 22, 2019 11:31
@morozov morozov removed this from the 2.10.0 milestone Jun 7, 2019
@morozov morozov added the PDO label Jun 7, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants