Condition
API reference › Soft Delete › Condition
Marks a query condition as owned by the soft-delete scope and qualifies its bare column names with a table alias.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$expressions protected | mixed[] | Default: null. | yii\ |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Creates a condition with optional table-alias qualification. | Condition |
fromArrayDefinition() static | Creates object by array-definition as described in Query Builder – Operator format guide article. | yii\ |
getExpressions() | yii\ | |
getOperator() | Returns the operator that is represented by this condition class, e.g. AND, OR. | yii\ |
map() static | Applies the callback to every soft-delete scope inside an and condition, recursing into nested and operands. | Condition |
withAlias() | Returns a new scope with the original condition qualified with the given table alias. | Condition |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(array<array-key, mixed> $condition, string|null $alias = null)Creates a condition with optional table-alias qualification.
Parameters
| Parameter | Type | Description |
|---|---|---|
$condition | array<array-key, | Condition in Yii array format, kept unqualified for withAlias(). The rows of an in column tuple given as a Traversable are read each time the condition is qualified, so pass an array or a rewindable iterator: a generator cannot be read again by a later withAlias(). |
$alias | string| | Table alias that qualifies bare column names, or null to keep them unqualified. |
map()
Section titled “map() ”public static function map(array<array-key, mixed> $condition, Closure(self): ?self $map): array<array-key, mixed>|nullApplies the callback to every soft-delete scope inside an and condition, recursing into nested and operands.
A scope the callback maps to null is removed, together with any nested and left without operands. Other
operands, and conditions that do not start with and, are returned unchanged.
Parameters
| Parameter | Type | Description |
|---|---|---|
$condition | array<array-key, | Query condition in Yii array format. |
$map | Closure(self): ?self | Callback that returns the replacement scope, or null to remove it. |
Returns
array<array-key, mixed>|null: The mapped condition, or null when no operand remains.
withAlias()
Section titled “withAlias() ”public function withAlias(string $alias): selfReturns a new scope with the original condition qualified with the given table alias.
Parameters
| Parameter | Type | Description |
|---|---|---|
$alias | string |
Returns
self