# Class yii\db\conditions\BetweenCondition

Inheritance | yii\db\conditions\BetweenCondition
Implements | yii\db\conditions\ConditionInterface
Available since version | 2.0.14
Source Code | https://github.com/yiisoft/yii2/blob/master/framework/db/conditions/BetweenCondition.php

Class BetweenCondition represents a `BETWEEN` condition.

## Public Methods

Hide inherited methods

Method | Description | Defined By
--- | --- | ---
__construct() | Creates a condition with the `BETWEEN` operator. | yii\db\conditions\BetweenCondition
fromArrayDefinition() | Creates object by array-definition as described in Query Builder – Operator format guide article. | yii\db\conditions\BetweenCondition
getColumn() |  | yii\db\conditions\BetweenCondition
getIntervalEnd() |  | yii\db\conditions\BetweenCondition
getIntervalStart() |  | yii\db\conditions\BetweenCondition
getOperator() |  | yii\db\conditions\BetweenCondition

## Method Details

Hide inherited methods

__construct() public method

Creates a condition with the `BETWEEN` operator.

public void __construct ( $column, $operator, $intervalStart, $intervalEnd )
$column | mixed | The literal to the left of $operator
$operator | string | The operator to use (e.g. `BETWEEN` or `NOT BETWEEN`)
$intervalStart | mixed | Beginning of the interval
$intervalEnd | mixed | End of the interval

Source code

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

fromArrayDefinition() public static method

Creates object by array-definition as described in Query Builder – Operator format guide article.

public static $this fromArrayDefinition ( $operator, $operands )
$operator | string | Operator in uppercase.
$operands | array | Array of corresponding operands
throws | yii\base\InvalidArgumentException | if wrong number of operands have been given.

Source code

                    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]);
    }

getColumn() public method

public mixed getColumn ( )

Source code

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

getIntervalEnd() public method

public mixed getIntervalEnd ( )

Source code

                    public function getIntervalEnd()
    {
        return $this->intervalEnd;
    }

getIntervalStart() public method

public mixed getIntervalStart ( )

Source code

                    public function getIntervalStart()
    {
        return $this->intervalStart;
    }

getOperator() public method

public string getOperator ( )

Source code

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