0 follower

Final Class Yiisoft\Db\QueryBuilder\Condition\ArrayOverlaps

InheritanceYiisoft\Db\QueryBuilder\Condition\ArrayOverlaps » Yiisoft\Db\QueryBuilder\Condition\AbstractOverlaps
ImplementsYiisoft\Db\QueryBuilder\Condition\ConditionInterface

Condition that represents ARRAY OVERLAPS operator is used to check if a column of array type overlaps another array.

Public Methods

Hide inherited methods

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

Method Details

Hide inherited methods

__construct() public method
public mixed __construct ( Yiisoft\Db\Expression\ExpressionInterface|string $column, Yiisoft\Db\Expression\ExpressionInterface|iterable $values )
$column Yiisoft\Db\Expression\ExpressionInterface|string

The column name or an expression.

$values Yiisoft\Db\Expression\ExpressionInterface|iterable

An array of values that {@see $columns} value should overlap.

                public function __construct(
    public readonly string|ExpressionInterface $column,
    public readonly iterable|ExpressionInterface $values,
) {}

            
fromArrayDefinition() public static method

Defined in: Yiisoft\Db\QueryBuilder\Condition\AbstractOverlaps::fromArrayDefinition()

Creates a condition based on the given operator and operands.

public static Yiisoft\Db\QueryBuilder\Condition\ArrayOverlaps 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): static
{
    if (!isset($operands[0], $operands[1])) {
        throw new InvalidArgumentException("Operator \"$operator\" requires two operands.");
    }
    /** @psalm-suppress UnsafeInstantiation */
    return new static(
        self::validateColumn($operator, $operands[0]),
        self::validateValues($operator, $operands[1]),
    );
}