-
Notifications
You must be signed in to change notification settings - Fork 30
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
[Keyword fieldtype] Added ORDER BY to keyword query #346
Conversation
da2aa00
to
2607fa3
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Do note however that Doctrine documentation does not endorse storing You can see there that they are re-requesting the Expression Builder from the Query Builder every time: <?php
// $qb instanceof QueryBuilder
$qb->select(array('u')) // string 'u' is converted to array internally
->from('User', 'u')
->where($qb->expr()->orX(
$qb->expr()->eq('u.id', '?1'),
$qb->expr()->like('u.nickname', '?2')
))
->orderBy('u.surname', 'ASC'); |
@Steveb-p not everything that is there follows best practices. This at some point popped up on some profiling tools not as performance issue (atm), but as something which might impact performance in the future. If you have deterministic function result called multiple times, you should expand it to variable, unless 3rd party doc explicitly says why you shouldn't. |
I have no doubt about that, but you can criticize any code library in a similar fashion, because there is always something that can be done differently.
It may stop being a deterministic function, because it is never stated that it is. It may start returning new |
We shouldn't add time and cognitive complexity to our code just because in a distant unlikely future something might change. The quoted examples are not convincing enough argument for me to change the approach. They're meant to visualize something else. If Doctrine states "always call |
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.
QA approved on IbexaDXP 3.3 commerce.
v3.3
and higherThe keyword fieldtype tests sometimes fail:
https://github.com/ibexa/core/actions/runs/3195771808/jobs/5217051683
The returned order of keywords is different from the one we except. It's because the query does not specify the expected order, meaning they can be returned in a random one.
Things done:
$query->expr()
to a separate variablefetchAll(FetchMode::COLUMN)
usageTesting
Basic sanities using the keyword fieldtype are needed (creating, updating)
Checklist:
$ composer fix-cs
).@ezsystems/engineering-team
).