Class yii\db\ArrayExpression
| Inheritance | yii\db\ArrayExpression |
|---|---|
| Implements | ArrayAccess, Countable, IteratorAggregate, yii\db\ExpressionInterface |
| Available since version | 2.0.14 |
| Source Code | https://github.com/yiisoft/yii2/blob/master/framework/db/ArrayExpression.php |
Class ArrayExpression represents an array SQL expression.
Expressions of this type can be used in conditions as well:
$query->andWhere(['@>', 'items', new ArrayExpression([1, 2, 3], 'integer')])
which, depending on DBMS, will result in a well-prepared condition. For example, in
PostgreSQL it will be compiled to WHERE "items" @> ARRAY[1, 2, 3]::integer[].
Public Methods
Method Details
ArrayExpression constructor.
| public void __construct ( $value, $type = null, $dimension = 1 ) | ||
| $value | array|yii\db\QueryInterface|mixed | The array content. Either represented as an array of values or a Query that returns these values. A single value will be considered as an array containing one element. |
| $type | string|null | The type of the array elements. Defaults to |
| $dimension | integer | The number of indices needed to select an element |
| public void count ( ) |
| public integer getDimension ( ) | ||
| return | integer | The number of indices needed to select an element |
|---|---|---|
| public void getIterator ( ) |
| public string|null getType ( ) |
| public array|mixed|yii\db\QueryInterface getValue ( ) |
| public void offsetExists ( $offset ) | ||
| $offset | ||
| public void offsetGet ( $offset ) | ||
| $offset | ||
| public void offsetSet ( $offset, $value ) | ||
| $offset | ||
| $value | ||
| public void offsetUnset ( $offset ) | ||
| $offset | ||