-
Notifications
You must be signed in to change notification settings - Fork 4
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-7653: Add IsContainer criterion support #63
IBX-7653: Add IsContainer criterion support #63
Conversation
8a2a19f
to
f8d8ed6
Compare
0e8149f
to
01555b4
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.
This is almost the same code as the Content\CriterionVisitor
. Consider extracting common code.
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.
From what I have checked, we do not extract the common part (e.g. LocationIdIn
, LocationRemoteIdIn
etc.) so I didn't want to introduce another abstraction just for IsContainer
.
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.
From what I have checked, we do not extract the common part (e.g.
LocationIdIn
,LocationRemoteIdIn
etc.) so I didn't want to introduce another abstraction just forIsContainer
.
This is a technical debt that can be easily mitigated. Sonar Cloud analysis is valid.
My question here would be if this can be refactored into a common base for all visitors or just for IsContainer? The latter approach is a minimum requirement.
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 would say that extracting this code into an abstract is debatable in this case. Those classes share code, but are for different domains.
I would argue that a trait is a candidate, especially since there are valid cases where code related to checking value is different for a Criterion. We basically need to inject a validation method to ensure that argument passed is correct. This is a specific behavior that we need for a particular set of Criterions.
Thoughts?
{ | ||
$value = $criterion->value; | ||
|
||
if (!is_array($value) || !is_bool($value[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.
Do we really accept array of values ?
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.
Currently, every scalar value is wrapped in an array here:
https://github.com/ibexa/core/blob/86d44648ace5e4ab48b9deae9e327145130113c9/src/contracts/Repository/Values/Content/Query/Criterion.php#L94
it was discussed with PHP and AFAICR we plan to change it in 5.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.
bb387fe
to
242b40f
Compare
242b40f
to
98eb4b6
Compare
Quality Gate passedIssues Measures |
CI is failing because [TMP] commits have been removed. |
Merged up:
|
v4.6
Checklist:
$ composer fix-cs
).@ibexa/php-dev
for back-end changes and/or@ibexa/javascript-dev
for front-end changes).