-
-
Notifications
You must be signed in to change notification settings - Fork 61
Apply LIMIT in getBy* methods #774
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
base: main
Are you sure you want to change the base?
Conversation
...extrasTests/Orm/Integration/Relationships/RelationshipManyHasManyTest_testCachingPreload.sql
Show resolved
Hide resolved
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.
LGTM, two little things please
src/Collection/DbalCollection.php
Outdated
| { | ||
| return $this->findBy($conds)->fetch(); | ||
| $collection = $this->findBy($conds); | ||
| if (FeatureToggle::$limitInGetBy && $this->connection->getPlatform()->getName() !== SqlServerPlatform::NAME) { |
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.
The condition on sql platform needs a comment/reasoning.
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.
Added comment about invalid syntax being generated.
SqlServer might also be supported in theory, but I was not able to do the necessary changes in QueryBuilder - there are more ways how to do it and none of them seems to behave the same as MySQL and PostgreSQL.
I'd suggest to add generated sql files to tests for MySQL and SqlServer before we do so.
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.
Hey, sorry to bother you once more, but the comment does not add any value - I already knew that you had tried it because it doesn't work. It would be great to add a meaningful example of what does not work or create a ticket and put it there, and put the link into the code... :)
Seeing the wrong SQL it generates everybody exploring the source code will be to "I see, now I understand why it behaves differently" :)
…aneous branch+PR builds
DbalCollection::getBy*(and inherentlyRepository::getBy*) methods applyLIMIT 1UNIQUE.ArrayCollectionbecause it is short-lived in this case and no such change was necessary.Incorrect syntax near 'OFFSET'.). I believe this should be handled in nextras/dbal?Nextras\Orm\FeatureToggle::$limitInGetBy = false;in case it causes any issues. This toggle is planned to be removed in v6.Build changes (that made my life easier):