Class LikeCondition represents a LIKE
condition.
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
.
The column name.
$operator stringThe operator to use (e.g. LIKE
, NOT LIKE
, OR LIKE
or OR NOT LIKE
)
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 is LIKE
or OR LIKE
and empty if operator is NOT LIKE
or OR NOT LIKE
.
public function __construct($column, $operator, $value)
{
parent::__construct($column, $operator, $value);
}
Creates object by array-definition as described in Query Builder – Operator format guide article.
public static function fromArrayDefinition($operator, $operands)
{
if (!isset($operands[0], $operands[1])) {
throw new InvalidArgumentException("Operator '$operator' requires two operands.");
}
$condition = new static($operands[0], $operator, $operands[1]);
if (isset($operands[2])) {
$condition->escapingReplacements = $operands[2];
}
return $condition;
}
public function getColumn()
{
return $this->column;
}
public function getEscapingReplacements()
{
return $this->escapingReplacements;
}
public function getOperator()
{
return $this->operator;
}
public function getValue()
{
return $this->value;
}
This method allows to specify how to escape special characters in the value(s).
public function setEscapingReplacements($escapingReplacements)
{
$this->escapingReplacements = $escapingReplacements;
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4