Skip to content
PHP Ecosystem
Explore

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.

PropertyTypeDescriptionDefined by
$expressions protectedmixed[]Default: null.yii\db\conditions\ConjunctionCondition
MethodDescriptionDefined by
__construct()Creates a condition with optional table-alias qualification.Condition
fromArrayDefinition() staticCreates object by array-definition as described in Query Builder – Operator format guide article.yii\db\conditions\ConjunctionCondition
getExpressions()yii\db\conditions\ConjunctionCondition
getOperator()Returns the operator that is represented by this condition class, e.g. AND, OR.yii\db\conditions\AndCondition
map() staticApplies 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
public function __construct(array<array-key, mixed> $condition, string|null $alias = null)

Creates a condition with optional table-alias qualification.

Parameters

ParameterTypeDescription
$conditionarray<array-key, mixed>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().
$aliasstring|nullTable alias that qualifies bare column names, or null to keep them unqualified.
public static function map(array<array-key, mixed> $condition, Closure(self): ?self $map): array<array-key, mixed>|null

Applies 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

ParameterTypeDescription
$conditionarray<array-key, mixed>Query condition in Yii array format.
$mapClosure(self): ?selfCallback 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.

public function withAlias(string $alias): self

Returns a new scope with the original condition qualified with the given table alias.

Parameters

ParameterTypeDescription
$aliasstring

Returns

self