LikeCondition
extends SimpleCondition
in package
Class LikeCondition represents a `LIKE` condition.
Tags
Table of Contents
Properties
- $escapingReplacements : array<string|int, mixed>|null|false
- $column : mixed
- $operator : string
- $value : mixed
Methods
- __construct() : mixed
- SimpleCondition constructor
- fromArrayDefinition() : $this
- Creates object by array-definition as described in [Query Builder – Operator format](guide:db-query-builder#operator-format) guide article.
- getColumn() : mixed
- getEscapingReplacements() : array<string|int, mixed>|null|false
- getOperator() : string
- getValue() : mixed
- setEscapingReplacements() : mixed
- This method allows to specify how to escape special characters in the value(s).
Properties
$escapingReplacements
protected
array<string|int, mixed>|null|false
$escapingReplacements
map of chars to their replacements, false
if characters should not be escaped
or either null
or empty array if escaping is condition builder responsibility.
By default it's set to null
.
$column
private
mixed
$column
the column name to the left of [[operator]]
$operator
private
string
$operator
the operator to use. Anything could be used e.g. >
, <=
, etc.
$value
private
mixed
$value
the value to the right of the [[operator]]
Methods
__construct()
SimpleCondition constructor
public
__construct(string $column, string $operator, array<string|int, string>|string $value) : mixed
Parameters
- $column : string
-
the column name.
- $operator : string
-
the operator to use (e.g.
LIKE
,NOT LIKE
,OR LIKE
orOR NOT LIKE
) - $value : array<string|int, string>|string
-
single value or an array of values that $column should be compared with. If it is an empty array the generated expression will be a
false
value if operator isLIKE
orOR LIKE
and empty if operator isNOT LIKE
orOR NOT LIKE
.
fromArrayDefinition()
Creates object by array-definition as described in [Query Builder – Operator format](guide:db-query-builder#operator-format) guide article.
public
static fromArrayDefinition(mixed $operator, mixed $operands) : $this
Parameters
- $operator : mixed
-
operator in uppercase.
- $operands : mixed
-
array of corresponding operands
Tags
Return values
$thisgetColumn()
public
getColumn() : mixed
getEscapingReplacements()
public
getEscapingReplacements() : array<string|int, mixed>|null|false
Return values
array<string|int, mixed>|null|falsegetOperator()
public
getOperator() : string
Return values
stringgetValue()
public
getValue() : mixed
setEscapingReplacements()
This method allows to specify how to escape special characters in the value(s).
public
setEscapingReplacements(mixed $escapingReplacements) : mixed
Parameters
- $escapingReplacements : mixed