Skip to content

Commit

Permalink
Behaviors: Abort filter condition processing upon type change
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nilmerg committed Aug 19, 2022
1 parent 0b76de0 commit b454e0f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Behaviors.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit b454e0f

Please sign in to comment.