-
Notifications
You must be signed in to change notification settings - Fork 1
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
IBX-6634: Fixed relationship comparison #11
Conversation
The changes are required for example to filtering recent activity logs by object class. Now filtering works correct. |
This fix has a side-effect on one of the pages in Ibexa DXP, and so needs revision. |
2ae1a4c seems to fix the issue of additional |
$qb->select($this->connection->getDatabasePlatform()->getCountExpression($tableAlias . '.' . $identifierColumn)); | ||
$qb->from($metadata->getTableName(), $tableAlias); | ||
$platform = $this->connection->getDatabasePlatform(); | ||
$qb->select($platform->getCountExpression(sprintf('DISTINCT %s.%s', $tableAlias, $identifierColumn))); |
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.
There's \Doctrine\DBAL\Query\QueryBuilder::distinct
but maybe not usable here given it's COUNT(DISTINCT )
not DISTINCT COUNT()
?
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, due to the above it is not usable. I have actually checked and we have a similar code in our ibexa/core
, and this syntax works for our supported databases.
new Comparison( | ||
'relationship_1.relationship_2.relationship_2_foo', | ||
'IN', | ||
'bar', | ||
), | ||
'relationship_2_table_name.relationship_2_foo IN :relationship_2_foo_0', |
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.
TBH I don't follow there relationship between what you declare this relationship and what you get from it (pun intended), but I think we've already discussed this ages ago, so I'll just continue scrolling :D
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.
@alongosz could you rephrase? I don't quite understand what part of the above is the issue? Is it that we are declaring relationships between tables?
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 4.6 commerce.
v4.6
This PR fixes issues that occur when a Criterion is used that represents a relationship condition.
For example,
LoggedAt
criterion which involved sub-tables with "lower than" condition was overwritten with a "equal to", because comparison operator was ignored - only value was used.Additionally, a few methods are exposed for use in descendants so that common operations when building a query can be performed without repetition.
EDIT: Additionally, this also apparently fixes an issue that happens when attempting to
countBy
items, while using sub-tables (pre-joined tables are missing).Checklist:
$ composer fix-cs
).@ibexa/php-dev
for back-end changes and/or@ibexa/javascript-dev
forfront-end changes).