Class yii\db\conditions\LikeCondition
LikeCondition 類別代表一個 LIKE
條件。
公共方法
屬性詳細資訊
字元到其替換字元的映射,如果字元不應被跳脫則為 false,如果跳脫是條件建構器的責任,則為 null 或空陣列。預設設定為 null。
方法詳細資訊
public void __construct ( $column, $operator, $value ) | ||
$column | 字串 |
欄位名稱。 |
$operator | 字串 |
要使用的運算子 (例如 |
$value | 字串[]|字串 |
單一值或一個數值陣列,用於與 $column 進行比較。如果它是一個空陣列,當運算子為 |
public function __construct($column, $operator, $value)
{
parent::__construct($column, $operator, $value);
}
依照 查詢語法建構器 – 運算符格式 指南文章中描述的陣列定義建立物件。
public static $this fromArrayDefinition ( $operator, $operands ) | ||
$operator | 字串 |
大寫的運算子。 |
$operands | 陣列 |
對應運算元的陣列 |
拋出 | yii\base\InvalidArgumentException |
如果給出的運算元數量錯誤。 |
---|
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 mixed getColumn ( ) |
public function getColumn()
{
return $this->column;
}
public array|null|false getEscapingReplacements ( ) |
public function getEscapingReplacements()
{
return $this->escapingReplacements;
}
public 字串 getOperator ( ) |
public function getOperator()
{
return $this->operator;
}
public mixed getValue ( ) |
public function getValue()
{
return $this->value;
}
此方法允許指定如何跳脫值中的特殊字元。
public void setEscapingReplacements ( $escapingReplacements ) | ||
$escapingReplacements |
public function setEscapingReplacements($escapingReplacements)
{
$this->escapingReplacements = $escapingReplacements;
}
註冊 或 登入 以發表評論。