0 follower

Final Class Yiisoft\Db\Expression\Function\ArrayMerge

InheritanceYiisoft\Db\Expression\Function\ArrayMerge » Yiisoft\Db\Expression\Function\MultiOperandFunction
ImplementsYiisoft\Db\Expression\ExpressionInterface

Represents an SQL expression that returns the merged array from a list of operands.

Example usage:

$arrayMerge = new ArrayMerge('column1', 'column2');

For example, it will be generated into the following SQL expression in PostgreSQL:

ARRAY(SELECT DISTINCT UNNEST("column1" || "column2"))

Protected Properties

Hide inherited properties

Property Type Description Defined By
$operands array List of operands. Yiisoft\Db\Expression\Function\MultiOperandFunction

Method Details

Hide inherited methods

__construct() public method
public mixed __construct ( mixed $operands )
$operands mixed

The values or expressions to operate on. String values will be treated as column names, except when they contain a parentheses (, in which case they will be treated as raw SQL expressions.

                public function __construct(mixed ...$operands)
{
    $this->operands = $operands;
}

            
add() public method
public Yiisoft\Db\Expression\Function\ArrayMerge add ( mixed $operand )
$operand mixed

                public function add(mixed $operand): static
{
    $this->operands[] = $operand;
    return $this;
}

            
getOperands() public method
public array getOperands ( )
return array

List of operands.

                public function getOperands(): array
{
    return $this->operands;
}

            
getOrdered() public method

Returns whether the result array should be ordered.

public boolean getOrdered ( )

                public function getOrdered(): bool
{
    return $this->ordered;
}

            
getType() public method

Returns the type of the operands. Empty string if not set.

public string|Yiisoft\Db\Schema\Column\ColumnInterface getType ( )

                public function getType(): string|ColumnInterface
{
    return $this->type;
}

            
ordered() public method

Sets whether the result array should be ordered.

public self ordered ( boolean $ordered true )
$ordered boolean

                public function ordered(bool $ordered = true): self
{
    $this->ordered = $ordered;
    return $this;
}

            
type() public method

Sets the type of the operands.

public self type ( string|Yiisoft\Db\Schema\Column\ColumnInterface $type )
$type string|Yiisoft\Db\Schema\Column\ColumnInterface

                public function type(string|ColumnInterface $type): self
{
    $this->type = $type;
    return $this;
}