-
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
Fix handle conditions #173
Conversation
…s, we do need the OPERATORS 'IS NULL' and 'IS NOT NULL' and since they are only available in the condition without values, some filters are not working anymore
…s, we do need the OPERATORS 'IS NULL' and 'IS NOT NULL' and since they are only available in the condition without values, some filters are not working anymore
…s, we do need the OPERATORS 'IS NULL' and 'IS NOT NULL' and since they are only available in the condition without values, some filters are not working anymore
if (array_key_exists(DrupalFilterParser::VALUE, $condition )) { | ||
if (!array_key_exists(DrupalFilterParser::OPERATOR, $condition ) | ||
|| ($condition[DrupalFilterParser::OPERATOR] !== 'IS NULL' | ||
&& $condition[DrupalFilterParser::OPERATOR] !== 'IS NOT NULL')) { | ||
return $this->drupalConditionFactory->createConditionWithValue($operatorName, $condition[DrupalFilterParser::VALUE], $path); | ||
} | ||
} |
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.
Handling specific operators is not the responsibility of this class. You can pass any implementation of DrupalConditionFactoryInterface
into this class' constructor to support any operator with any value as you desire.
Such implementation can be done outside of this library as it depends on the specific use case and filters you want to support, which should not be coupled to this library.
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 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.
How do you intend to handle the value unassigned
in this example?
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 is no need for this value 'unassigned' appart from informing the FE about there filterChoice and we tried removing it.
If the value is not set - we get a constraint violation within the drupalFilterValidator that complains about a missing Value. But that means the condition to call the method createConditionWithoutValue cant be met.
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.
If the value is not set - we get a constraint violation within the drupalFilterValidator
@MoritzMandler: In that case I'd like to verify the correct behavior of DrupalFilterValidator
. From what you wrote I deduced the following test case. It succeeds in my environment, though I'm not sure regarding the exact branch you're on. Could you please adjust it based on your actual observations, so that the mentioned constraint violation is thrown?
$factory = new PredefinedDrupalConditionFactory(
new DqlConditionFactory()
);
$validator = new DrupalFilterValidator(
Validation::createValidator(),
$factory
);
$validator->validateFilter([
"foo" => [
"condition" => [
"path" => "assignee",
"operator" => "IS NULL"
]
]
]);
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 changes are not required anymore, this will be handled in core |
Ticket: https://demoseurope.youtrack.cloud/issue/DPLAN-12254/Filter-Bearbeiter-Nicht-zugewiesen-funktioniert-nicht
Description: in some cases however conditions do have values, we do need the OPERATORS 'IS NULL' and 'IS NOT NULL' and since they are only available in the condition without values, some filters are not working anymore