0 追蹤者

類別 yii\db\conditions\SimpleCondition

繼承關係yii\db\conditions\SimpleCondition
實作介面yii\db\conditions\ConditionInterface
子類別yii\db\conditions\LikeCondition
自版本起可用2.0.14
原始碼 https://github.com/yiisoft/yii2/blob/master/framework/db/conditions/SimpleCondition.php

SimpleCondition 類別代表一個簡單的條件,例如 "column" 運算子 value

方法詳情

隱藏繼承方法

__construct() 公開方法

SimpleCondition 建構子

public void __construct ( $column, $operator, $value )
$column mixed

$operator 左側的字面值

$operator string

要使用的運算子。可以使用任何符號,例如 ><= 等。

$value mixed

$operator 右側的字面值

                public function __construct($column, $operator, $value)
{
    $this->column = $column;
    $this->operator = $operator;
    $this->value = $value;
}

            
fromArrayDefinition() 公開靜態方法

依據陣列定義建立物件,如 查詢語法建構器 – 運算子格式 指南文章所述。

public static $this fromArrayDefinition ( $operator, $operands )
$operator string

大寫的運算子。

$operands array

對應運算元的陣列

throws yii\base\InvalidArgumentException

如果給定的運算元數量錯誤。

                public static function fromArrayDefinition($operator, $operands)
{
    if (count($operands) !== 2) {
        throw new InvalidArgumentException("Operator '$operator' requires two operands.");
    }
    return new static($operands[0], $operator, $operands[1]);
}

            
getColumn() 公開方法

public mixed getColumn ( )

                public function getColumn()
{
    return $this->column;
}

            
getOperator() 公開方法

public string getOperator ( )

                public function getOperator()
{
    return $this->operator;
}

            
getValue() 公開方法

public mixed getValue ( )

                public function getValue()
{
    return $this->value;
}