0 follower

Class yii\db\conditions\SimpleCondition

Inheritanceyii\db\conditions\SimpleCondition
Implementsyii\db\conditions\ConditionInterface
Subclassesyii\db\conditions\LikeCondition
Available since version2.0.14
Source Code https://github.com/yiisoft/yii2/blob/master/framework/db/conditions/SimpleCondition.php

Class SimpleCondition represents a simple condition like "column" operator value.

Method Details

Hide inherited methods

__construct() public method

SimpleCondition constructor

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

The literal to the left of $operator

$operator string

The operator to use. Anything could be used e.g. >, <=, etc.

$value mixed

The literal to the right of $operator

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

            
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.

                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 method

public mixed getColumn ( )

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

            
getOperator() public method

public string getOperator ( )

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

            
getValue() public method

public mixed getValue ( )

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