From b454e0f768025877b4f4b11fee6945675fa4c086 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 19 Aug 2022 09:35:54 +0200 Subject: [PATCH] Behaviors: Abort filter condition processing upon type change This relies on the fact that the `FilterProcessor` re-evaluates the behaviors for a changed filter. So any skipped behaviors then get their chance to process the result. fixes #45 --- src/Behaviors.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Behaviors.php b/src/Behaviors.php index 5c54350..c77f3c7 100644 --- a/src/Behaviors.php +++ b/src/Behaviors.php @@ -155,6 +155,10 @@ public function rewriteCondition(Filter\Condition $condition, $relation = null) $replacement = $behavior->rewriteCondition($filter ?: $condition, $relation); if ($replacement !== null) { $filter = $replacement; + if (! $filter instanceof Filter\Condition) { + // Other behaviors get their chance once the replacement is being processed + break; + } } }