|
10 | 10 | use Yiisoft\Db\Constant\PseudoType;
|
11 | 11 | use Yiisoft\Db\Constant\ReferentialAction;
|
12 | 12 | use Yiisoft\Db\Constraint\ForeignKey;
|
| 13 | +use Yiisoft\Db\Expression\Statement\CaseX; |
| 14 | +use Yiisoft\Db\Expression\Statement\When; |
13 | 15 | use Yiisoft\Db\Expression\Value\ArrayExpression;
|
14 | 16 | use Yiisoft\Db\Expression\Expression;
|
15 | 17 | use Yiisoft\Db\Expression\Function\ArrayMerge;
|
@@ -455,13 +457,17 @@ public static function prepareValue(): array
|
455 | 457 | return $values;
|
456 | 458 | }
|
457 | 459 |
|
458 |
| - public static function caseExpressionBuilder(): array |
| 460 | + public static function caseXBuilder(): array |
459 | 461 | {
|
460 |
| - $data = parent::caseExpressionBuilder(); |
| 462 | + $data = parent::caseXBuilder(); |
461 | 463 |
|
462 | 464 | $data['with case expression'] = [
|
463 |
| - $data['with case expression'][0]->else( |
464 |
| - new Expression('to_number(:qp0)', [':qp0' => $param = new Param(4, DataType::INTEGER)]) |
| 465 | + $data['with case expression'][0] = new CaseX( |
| 466 | + '(1 + 2)', |
| 467 | + when1: new When(1, 1), |
| 468 | + when2: new When(2, new Expression('2')), |
| 469 | + when3: new When(3, '(2 + 1)'), |
| 470 | + else: new Expression('to_number(:qp0)', [':qp0' => $param = new Param(4, DataType::INTEGER)]), |
465 | 471 | ),
|
466 | 472 | 'CASE (1 + 2) WHEN 1 THEN 1 WHEN 2 THEN 2 WHEN 3 THEN (2 + 1) ELSE to_number(:qp0) END',
|
467 | 473 | [':qp0' => $param],
|
|
0 commit comments