0 follower

Abstract Class Yiisoft\Db\Expression\Value\Builder\AbstractArrayValueBuilder

InheritanceYiisoft\Db\Expression\Value\Builder\AbstractArrayValueBuilder
ImplementsYiisoft\Db\Expression\ExpressionBuilderInterface
SubclassesYiisoft\Db\Expression\Value\Builder\ArrayValueBuilder

Abstract expression builder for {@see ArrayValue}.

Public Methods

Hide inherited 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

Hide inherited 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

Hide inherited methods

__construct() public method

public mixed __construct ( Yiisoft\Db\QueryBuilder\QueryBuilderInterface $queryBuilder )
$queryBuilder Yiisoft\Db\QueryBuilder\QueryBuilderInterface

                public function __construct(protected readonly QueryBuilderInterface $queryBuilder) {}

            
build() public method

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);
}

            
buildStringValue() protected abstract method

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;

            
buildSubquery() protected abstract method

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;

            
buildValue() protected abstract method

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;

            
getLazyArrayValue() protected abstract method

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;