類別 yii\db\conditions\ExistsCondition
繼承 | yii\db\conditions\ExistsCondition |
---|---|
實作 | yii\db\conditions\ConditionInterface |
自版本起可用 | 2.0.14 |
原始碼 | https://github.com/yiisoft/yii2/blob/master/framework/db/conditions/ExistsCondition.php |
表示 EXISTS
運算子的條件。
公用方法
方法 | 描述 | 定義於 |
---|---|---|
__construct() | ExistsCondition 建構子。 | yii\db\conditions\ExistsCondition |
fromArrayDefinition() | 依據 查詢語法建構器 – 運算子格式 指南文章中的陣列定義建立物件。 | yii\db\conditions\ExistsCondition |
getOperator() | yii\db\conditions\ExistsCondition | |
getQuery() | yii\db\conditions\ExistsCondition |
方法詳情
ExistsCondition 建構子。
public void __construct ( $operator, $query ) | ||
$operator | 字串 |
要使用的運算子 (例如 |
$query | yii\db\Query |
代表子查詢的 yii\db\Query 物件。 |
public function __construct($operator, $query)
{
$this->operator = $operator;
$this->query = $query;
}
依據 查詢語法建構器 – 運算子格式 指南文章中的陣列定義建立物件。
public static $this fromArrayDefinition ( $operator, $operands ) | ||
$operator | 字串 |
大寫的運算子。 |
$operands | 陣列 |
對應運算元的陣列 |
拋出 | yii\base\InvalidParamException |
如果輸入參數不適用於此條件 |
---|
public static function fromArrayDefinition($operator, $operands)
{
if (!isset($operands[0]) || !$operands[0] instanceof Query) {
throw new InvalidArgumentException('Subquery for EXISTS operator must be a Query object.');
}
return new static($operator, $operands[0]);
}
註冊 或 登入 以進行評論。