123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <?php
- namespace yii\db\conditions;
- use yii\base\InvalidArgumentException;
- use yii\db\ExpressionInterface;
- use yii\db\Query;
- class BetweenColumnsCondition implements ConditionInterface
- {
-
- private $operator;
-
- private $value;
-
- private $intervalStartColumn;
-
- private $intervalEndColumn;
-
- public function __construct($value, $operator, $intervalStartColumn, $intervalEndColumn)
- {
- $this->value = $value;
- $this->operator = $operator;
- $this->intervalStartColumn = $intervalStartColumn;
- $this->intervalEndColumn = $intervalEndColumn;
- }
-
- public function getOperator()
- {
- return $this->operator;
- }
-
- public function getValue()
- {
- return $this->value;
- }
-
- public function getIntervalStartColumn()
- {
- return $this->intervalStartColumn;
- }
-
- public function getIntervalEndColumn()
- {
- return $this->intervalEndColumn;
- }
-
- public static function fromArrayDefinition($operator, $operands)
- {
- if (!isset($operands[0], $operands[1], $operands[2])) {
- throw new InvalidArgumentException("Operator '$operator' requires three operands.");
- }
- return new static($operands[0], $operator, $operands[1], $operands[2]);
- }
- }
|