Abstract Class Yiisoft\Db\Expression\Value\Builder\AbstractArrayValueBuilder
| Inheritance | Yiisoft\Db\Expression\Value\Builder\AbstractArrayValueBuilder |
|---|---|
| Implements | Yiisoft\Db\Expression\ExpressionBuilderInterface |
| Subclasses | Yiisoft\Db\Expression\Value\Builder\ArrayValueBuilder |
Abstract expression builder for {@see ArrayValue}.
Protected Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $queryBuilder | Yiisoft\Db\QueryBuilder\QueryBuilderInterface | Yiisoft\Db\Expression\Value\Builder\AbstractArrayValueBuilder |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Db\Expression\Value\Builder\AbstractArrayValueBuilder | |
| build() | The Method builds the raw SQL from the $expression that won't be additionally escaped or quoted. |
Yiisoft\Db\Expression\Value\Builder\AbstractArrayValueBuilder |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| buildStringValue() | Builds an SQL expression for a string value. | Yiisoft\Db\Expression\Value\Builder\AbstractArrayValueBuilder |
| buildSubquery() | Build an array expression from a sub-query object. | Yiisoft\Db\Expression\Value\Builder\AbstractArrayValueBuilder |
| buildValue() | Builds a SQL expression for an array value. | Yiisoft\Db\Expression\Value\Builder\AbstractArrayValueBuilder |
| getLazyArrayValue() | Returns the value of the lazy array as an array or a raw string depending on the implementation. | Yiisoft\Db\Expression\Value\Builder\AbstractArrayValueBuilder |
Property Details
Method Details
| public mixed __construct ( Yiisoft\Db\QueryBuilder\QueryBuilderInterface $queryBuilder ) | ||
| $queryBuilder | Yiisoft\Db\QueryBuilder\QueryBuilderInterface | |
public function __construct(protected readonly QueryBuilderInterface $queryBuilder) {}
The Method builds the raw SQL from the $expression that won't be additionally escaped or quoted.
| public string build ( Yiisoft\Db\Expression\Value\ArrayValue $expression, array &$params = [] ) | ||
| $expression | Yiisoft\Db\Expression\Value\ArrayValue |
The expression to build. |
| $params | array |
The binding parameters. |
| return | string |
The raw SQL that won't be additionally escaped or quoted. |
|---|---|---|
public function build(ExpressionInterface $expression, array &$params = []): string
{
$value = $expression->value;
if ($value === null) {
return 'NULL';
}
if ($value instanceof LazyArrayInterface) {
$value = $this->getLazyArrayValue($value);
}
if (is_string($value)) {
return $this->buildStringValue($value, $expression, $params);
}
if ($value instanceof QueryInterface) {
return $this->buildSubquery($value, $expression, $params);
}
return $this->buildValue($value, $expression, $params);
}
Builds an SQL expression for a string value.
| protected abstract string buildStringValue ( string $value, Yiisoft\Db\Expression\Value\ArrayValue $expression, array &$params ) | ||
| $value | string |
The valid SQL string representation of the array value. |
| $expression | Yiisoft\Db\Expression\Value\ArrayValue |
The array expression. |
| $params | array |
The binding parameters. |
| return | string |
The SQL expression representing the array value. |
|---|---|---|
abstract protected function buildStringValue(string $value, ArrayValue $expression, array &$params): string;
Build an array expression from a sub-query object.
| protected abstract string buildSubquery ( Yiisoft\Db\Query\QueryInterface $query, Yiisoft\Db\Expression\Value\ArrayValue $expression, array &$params ) | ||
| $query | Yiisoft\Db\Query\QueryInterface |
The sub-query object. |
| $expression | Yiisoft\Db\Expression\Value\ArrayValue |
The array expression. |
| $params | array |
The binding parameters. |
| return | string |
The sub-query SQL expression representing an array. |
|---|---|---|
abstract protected function buildSubquery(
QueryInterface $query,
ArrayValue $expression,
array &$params,
): string;
Builds a SQL expression for an array value.
| protected abstract string buildValue ( iterable $value, Yiisoft\Db\Expression\Value\ArrayValue $expression, array &$params ) | ||
| $value | iterable |
The array value. |
| $expression | Yiisoft\Db\Expression\Value\ArrayValue |
The array expression. |
| $params | array |
The binding parameters. |
| return | string |
The SQL expression representing the array value. |
|---|---|---|
abstract protected function buildValue(iterable $value, ArrayValue $expression, array &$params): string;
Returns the value of the lazy array as an array or a raw string depending on the implementation.
| protected abstract array|string getLazyArrayValue ( Yiisoft\Db\Schema\Data\LazyArrayInterface $value ) | ||
| $value | Yiisoft\Db\Schema\Data\LazyArrayInterface |
The lazy array value. |
| return | array|string |
The value of the lazy array. |
|---|---|---|
abstract protected function getLazyArrayValue(LazyArrayInterface $value): array|string;
Signup or Login in order to comment.