-
Notifications
You must be signed in to change notification settings - Fork 6
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
Allow ConnectionLocator to be used with PDO Persistent Connections #12
Conversation
Nice. Give me a bit to look this over. Thanks! |
Thank you! |
Hi @pmjones, was wondering if you had any time to look at this further. If you have concerns or think a different approach would be better, please let me know. |
…tion, removed test case which would no longer be applicable, and modified the LoggedStatement class to be a proxy wrapping the PDOStatement class.
Hi @pmjones, I came back to look over this PR and realized what a mistake I had made in the changes to the |
Hi @pmjones, it's been a while since I last commented here on this. Could you please give an update on your thoughts for this PR and the issue it attempts to resolve? Any feedback would be greatly appreciated. As an aside, it does appear that doctrine/dbal previously had a similar lack of support. That was resolved recently with this PR. |
Hey @dbraff looking at it today -- thanks for your patience! |
@dbraff Would it be fair to say that the bulk of the change is to explicitly add PDOStatement methods to LoggedStatement, so that the internal $statement methods called directly, instead of making parent::*() calls? |
Hi @pmjones, thanks for getting back to me on this!
Yes, I would agree that's fair to say. I wish there was a less repetitive way to wrap the |
I don't think there is; one's first thought is to use |
Yeah, that was my first thought as well. |
All right, I think this looks good! Couple of typos but nothing major. The LoggedStatement test coverage has dropped to 50%, though, because of the newly-added methods. Will merge, then add tests, then release. Thanks for your work, and (again) for your patience! |
No problem at all! Thank you taking the time to look at it, looking forward to bringing this library up again at my organization! |
This PR modifies the
LoggedStatement
class to be a proxy wrapping thePDOStatement
class, which is constructed by theConnection
class injecting thePDOStatement
into it when logging is enabled.This allows persistent connections to be used along with the logging functionality and the
ConnectionLocator
.In order to maintain the existing type hints for methods returning a
PDOStatement
instance, this was done by overriding each of the method of the parent class as opposed to using the magic__call
method.A test case was added to cover the case of a
ConnectionLocator
with a persistent connection, and an existing test case, which verified thatPDO
natively returnedLoggedStatement
instances, was removed as it would no longer be applicable.