Skip to content

Commit e8386fb

Browse files
committed
Adapt to refactor "WITH" in Yii DB
1 parent 47ab0de commit e8386fb

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/DQLQueryBuilder.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Yiisoft\Db\Oracle\Builder\LongestBuilder;
1515
use Yiisoft\Db\Oracle\Builder\ShortestBuilder;
1616
use Yiisoft\Db\Query\Query;
17+
use Yiisoft\Db\Query\WithQuery;
1718
use Yiisoft\Db\QueryBuilder\AbstractDQLQueryBuilder;
1819
use Yiisoft\Db\QueryBuilder\Condition\In;
1920
use Yiisoft\Db\QueryBuilder\Condition\Like;
@@ -77,14 +78,18 @@ public function buildFrom(array|null $tables, array &$params): string
7778
return parent::buildFrom($tables, $params);
7879
}
7980

80-
public function buildWithQueries(array $withs, array &$params): string
81+
public function buildWithQueries(array $withQueries, array &$params): string
8182
{
82-
/** @psalm-var array{query:string|Query, alias:ExpressionInterface|string, recursive:bool}[] $withs */
83-
foreach ($withs as &$with) {
84-
$with['recursive'] = false;
85-
}
86-
87-
return parent::buildWithQueries($withs, $params);
83+
$withQueries = array_map(
84+
static fn(WithQuery $withQuery) => new WithQuery(
85+
$withQuery->query,
86+
$withQuery->alias,
87+
false
88+
),
89+
$withQueries,
90+
);
91+
92+
return parent::buildWithQueries($withQueries, $params);
8893
}
8994

9095
protected function defaultExpressionBuilders(): array

0 commit comments

Comments
 (0)