-
-
Notifications
You must be signed in to change notification settings - Fork 48
Add ability to use querybuilder inside DbalLimitOffsetExtractor #213
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
Conversation
| private readonly Connection $connection, | ||
| private readonly Table $table, | ||
| private readonly array $orderBy, | ||
| private readonly QueryBuilder $queryBuilder, |
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 must say I'm not a huge fan of this solution, there is already an existing DbalQueryExtractor that should allow you to pass custom query, the whole purpose of using DbalLimitOffsetExtractor was to simplify the most common use case where you just need to extract a single table.
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.
But does DbalQueryExtractor support chunking?
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.
yes, its all about how you generate parameters
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.
Well, but you have to manually query for count and manually prepare all offset-limit pairs? Looks like a lot of userland code for adding one join to query :)
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.
So, WDYT? Because this is real requirement from real code using this library, if you don't want to merge such extractor into lib I can make external lib for that, but I really think that it is extremely useful to be able to write such queries in extractor with small to none additional dependency (some dbal classes were already imported in this class anyway).
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 have an idea, it would be a BC break but might be worth it.
What we can do is to follow your approach with QueryBuilder but then add some simple static constructor that would prepare query builder in the way current constructor works.
This way whoever will need to iterate over simple table will use static constructor and more advanced use cases would require custom query builder.
|
@mleczakm I believe that what I just merged should solve your join (and any other) problems with custom queries |
Change Log
Added
Fixed
Changed
Removed
Deprecated
Security
Description
I had to query with join and iterate over chunks - modyfying DbalLimitOffsetExtractor was easiest way, I think it could be useful for everyone, and current part of lib life still allows to change contracts.