0 follower

Final Class Yiisoft\Db\Expression\Statement\WhenThen

InheritanceYiisoft\Db\Expression\Statement\WhenThen

Represents the condition and the result of a WHEN-THEN clause in a SQL CASE statement.

See also Yiisoft\Db\Expression\Statement\CaseX.

Property Details

Hide inherited properties

$then public property
public mixed $then null
$when public property
public mixed $when null

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( mixed $when, mixed $then )
$when mixed

The value or condition for the WHEN-THEN clause:

  • array is treated as a condition to check, see {@see \Yiisoft\Db\Query\QueryInterface::where()};
  • other values will be converted to their string representation using {@see \Yiisoft\Db\QueryBuilder\QueryBuilderInterface::buildValue()}.
$then mixed

The result to return if the condition is true. The value will be converted to its string representation using {@see \Yiisoft\Db\QueryBuilder\QueryBuilderInterface::buildValue()}.

                public function __construct(
    public readonly mixed $when,
    public readonly mixed $then,
) {}