Final Class Yiisoft\Db\Expression\Function\ArrayMerge
| Inheritance | Yiisoft\Db\Expression\Function\ArrayMerge » Yiisoft\Db\Expression\Function\MultiOperandFunction |
|---|---|
| Implements | Yiisoft\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
| Property | Type | Description | Defined By |
|---|---|---|---|
| $operands | array | List of operands. | Yiisoft\Db\Expression\Function\MultiOperandFunction |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Db\Expression\Function\MultiOperandFunction | |
| add() | Yiisoft\Db\Expression\Function\MultiOperandFunction | |
| getOperands() | Yiisoft\Db\Expression\Function\MultiOperandFunction | |
| getOrdered() | Returns whether the result array should be ordered. | Yiisoft\Db\Expression\Function\ArrayMerge |
| getType() | Returns the type of the operands. Empty string if not set. | Yiisoft\Db\Expression\Function\ArrayMerge |
| ordered() | Sets whether the result array should be ordered. | Yiisoft\Db\Expression\Function\ArrayMerge |
| type() | Sets the type of the operands. | Yiisoft\Db\Expression\Function\ArrayMerge |
Method Details
| 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 |
public function __construct(mixed ...$operands)
{
$this->operands = $operands;
}
| public Yiisoft\Db\Expression\Function\ArrayMerge add ( mixed $operand ) | ||
| $operand | mixed | |
public function add(mixed $operand): static
{
$this->operands[] = $operand;
return $this;
}
| public array getOperands ( ) | ||
| return | array |
List of operands. |
|---|---|---|
public function getOperands(): array
{
return $this->operands;
}
Returns whether the result array should be ordered.
| public boolean getOrdered ( ) |
public function getOrdered(): bool
{
return $this->ordered;
}
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;
}
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;
}
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;
}
Signup or Login in order to comment.