Class yii\db\conditions\SimpleCondition
| Inheritance | yii\db\conditions\SimpleCondition |
|---|---|
| Implements | yii\db\conditions\ConditionInterface |
| Subclasses | yii\db\conditions\LikeCondition |
| Available since version | 2.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.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | SimpleCondition constructor | yii\db\conditions\SimpleCondition |
| fromArrayDefinition() | Creates object by array-definition as described in Query Builder – Operator format guide article. | yii\db\conditions\SimpleCondition |
| getColumn() | yii\db\conditions\SimpleCondition | |
| getOperator() | yii\db\conditions\SimpleCondition | |
| getValue() | yii\db\conditions\SimpleCondition |
Method Details
SimpleCondition constructor
| public mixed __construct ( mixed $column, string $operator, mixed $value ) | ||
| $column | mixed | The literal to the left of $operator |
| $operator | string | The operator to use. Anything could be used e.g. |
| $value | mixed | The literal to the right of $operator |
public function __construct($column, $operator, $value) { $this->column = $column; $this->operator = $operator; $this->value = $value; } Creates object by array-definition as described in Query Builder – Operator format guide article.
| public static static fromArrayDefinition ( mixed $operator, mixed $operands ) | ||
| $operator | mixed | Operator in uppercase. |
| $operands | mixed | 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]); }
Signup or Login in order to comment.