1 | <?php |
||
13 | class LikeCondition extends SimpleCondition |
||
14 | { |
||
15 | /** |
||
16 | * @var array map of chars to their replacements. |
||
17 | * By default it's set to `null` meaning responsibility is fully on condition builder. |
||
18 | */ |
||
19 | protected $escapingReplacements; |
||
20 | |||
21 | /** |
||
22 | * @param string $column the column name. |
||
23 | * @param string $operator the operator to use (e.g. `LIKE`, `NOT LIKE`, `OR LIKE` or `OR NOT LIKE`) |
||
24 | * @param string[]|string $value single value or an array of values that $column should be compared with. |
||
25 | * If it is an empty array the generated expression will be a `false` value if operator is `LIKE` or `OR LIKE` |
||
26 | * and empty if operator is `NOT LIKE` or `OR NOT LIKE`. |
||
27 | */ |
||
28 | 78 | public function __construct($column, $operator, $value) |
|
32 | |||
33 | /** |
||
34 | * This method allows to specify how to escape special characters in the value(s). |
||
35 | * |
||
36 | * @param array an array of mappings from the special characters to their escaped counterparts. |
||
37 | * You may use `false` or an empty array to indicate the values are already escaped and no escape |
||
38 | * should be applied. Note that when using an escape mapping (or the third operand is not provided), |
||
39 | * the values will be automatically enclosed within a pair of percentage characters. |
||
40 | */ |
||
41 | public function setEscapingReplacements($escapingReplacements) |
||
45 | |||
46 | /** |
||
47 | * @return array |
||
48 | */ |
||
49 | 78 | public function getEscapingReplacements() |
|
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | * @throws InvalidArgumentException if wrong number of operands have been given. |
||
57 | */ |
||
58 | 78 | public static function fromArrayDefinition($operator, $operands) |
|
71 | } |
||
72 |