0 follower

Final Class Yiisoft\Db\QueryBuilder\Condition\Simple

InheritanceYiisoft\Db\QueryBuilder\Condition\Simple
ImplementsYiisoft\Db\QueryBuilder\Condition\ConditionInterface

Represents a simple condition like "column" operator value.

Public Methods

Hide inherited methods

Method Description Defined By
__construct() Yiisoft\Db\QueryBuilder\Condition\Simple
fromArrayDefinition() Creates a condition based on the given operator and operands. Yiisoft\Db\QueryBuilder\Condition\Simple

Property Details

Hide inherited properties

$column public property
$operator public property
public string $operator null
$value public property
public mixed $value null

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( Yiisoft\Db\Expression\ExpressionInterface|string $column, string $operator, mixed $value )
$column Yiisoft\Db\Expression\ExpressionInterface|string

The column name or an expression.

$operator string

The operator to use such as > or <=.

$value mixed

The value to the right of {@see $operator}.

                public function __construct(
    public readonly string|ExpressionInterface $column,
    public readonly string $operator,
    public readonly mixed $value,
) {}

            
fromArrayDefinition() public static method

Creates a condition based on the given operator and operands.

public static self fromArrayDefinition ( string $operator, array $operands )
$operator string
$operands array
throws InvalidArgumentException

If the number of operands isn't 2.

                public static function fromArrayDefinition(string $operator, array $operands): self
{
    if (isset($operands[0]) && array_key_exists(1, $operands)) {
        return new self(self::validateColumn($operator, $operands[0]), $operator, $operands[1]);
    }
    throw new InvalidArgumentException("Operator '$operator' requires two operands.");
}