Class yii\db\conditions\NotCondition

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

Condition that inverts passed condition.

Public Methods

Hide inherited methods

Method Description Defined By
__construct() NotCondition constructor. yii\db\conditions\NotCondition
fromArrayDefinition() Creates object by array-definition as described in Query Builder – Operator format guide article. yii\db\conditions\NotCondition
getCondition() yii\db\conditions\NotCondition

Method Details

Hide inherited methods

__construct() public method

NotCondition constructor.

public void __construct ( $condition )
$condition mixed

The condition to be negated

                public function __construct($condition)
{
    $this->condition = $condition;
}

            
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) !== 1) {
        throw new InvalidArgumentException("Operator '$operator' requires exactly one operand.");
    }
    return new static(array_shift($operands));
}

            
getCondition() public method

public mixed getCondition ( )

                public function getCondition()
{
    return $this->condition;
}