-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fix loose typing of constructor for transaction level, and remove public property. #22535
Conversation
b1cdf57
to
dcb4b94
Compare
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.
In general the changes look good, I've got a few suggestions for better consistency and perhaps less code:
- keep the order of the methods in the interface consistent in order of get/set for a property, then get/set for the other. Now it's get/set/set/get.
- consider using a trait as the implementation of the four methods is identical across 4 classes. If other db schemas need different implementation they can opt to not use the trait and implement the methods directly.
If someone else feels like we shouldn't use a trait here I'd be happy to concede here but the consistency would be nice even when not functionally important.
Thanks for taking a look, i've reordered the methods to make it a bit more consistent. I've added a commit with traits, take a look and tell me if you are happy with that approach, traits of course have their problems. |
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.
This looks good, thanks! The static vs the dynamic set of calls is annoying, it could probably be done somehow via some magic, but that would be at the expense of legibility and long-term maintainability, so all good as it is.
Description:
This is a possible first step to fix the problem with the very loosely typed dependency that the
TransactionLevel
class has.This also removes that nasty public property
$supportsUncommitted;
and introduces some encapsulation for that concept.The problem is identifying a common interface between:
There are of course
fetchOne
query
, however some classes have them statically and others not, so an interface isn't possible.My idea/solution does cause a little duplication, but I think having:
Is more important here.
Review