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