summaryrefslogtreecommitdiffstats
path: root/vendor/ipl/orm/src/Contract/RewriteFilterBehavior.php
blob: af6de5b872b3a4dd6af17782b2d2d81f0e6612d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

namespace ipl\Orm\Contract;

use ipl\Orm\Behavior;
use ipl\Stdlib\Filter;

interface RewriteFilterBehavior extends Behavior
{
    /**
     * Rewrite the given filter condition
     *
     * The condition can either be adjusted directly or replaced by an entirely new rule. The result must be
     * returned otherwise (NULL is returned) processing continues normally. (Isn't restarted)
     *
     * If a result is returned, it is required to append the given absolute path of the model to the column.
     * Processing of the condition will be restarted, hence the column has to be an absolute path again.
     *
     * @param Filter\Condition $condition
     * @param string           $relation The absolute path (with a trailing dot) of the model
     *
     * @return Filter\Rule|null
     */
    public function rewriteCondition(Filter\Condition $condition, $relation = null);
}