1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace yii\db\conditions;
- use yii\base\InvalidArgumentException;
- use yii\db\Query;
- class ExistsCondition implements ConditionInterface
- {
-
- private $operator;
-
- private $query;
-
- public function __construct($operator, $query)
- {
- $this->operator = $operator;
- $this->query = $query;
- }
-
- 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]);
- }
-
- public function getOperator()
- {
- return $this->operator;
- }
-
- public function getQuery()
- {
- return $this->query;
- }
- }
|