Final Class Yiisoft\Db\QueryBuilder\Condition\Simple
| Inheritance | Yiisoft\Db\QueryBuilder\Condition\Simple |
|---|---|
| Implements | Yiisoft\Db\QueryBuilder\Condition\ConditionInterface |
Represents a simple condition like "column" operator value.
Public Properties
Public 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
Method Details
| 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 |
| $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,
) {}
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.");
}
Signup or Login in order to comment.