Skip to content

Commit 3f2cb3d

Browse files
zacharylundondrejmirtes
authored andcommitted
Fix subselect aggregate functions
1 parent 21eb848 commit 3f2cb3d

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/Type/Doctrine/Query/QueryAggregateFunctionDetectorTreeWalker.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ public function walkNode($node): void
2525
return;
2626
}
2727

28+
if ($node instanceof AST\Subselect) {
29+
return;
30+
}
31+
2832
if ($this->isAggregateFunction($node)) {
2933
$this->markAggregateFunctionFound();
3034
return;

tests/Platform/QueryResultTypeWalkerFetchTypeMatrixTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3833,6 +3833,22 @@ public static function provideCases(): iterable
38333833
'stringify' => self::STRINGIFY_NONE,
38343834
];
38353835

3836+
yield 'SUBSELECT' => [
3837+
'data' => self::dataDefault(),
3838+
'select' => 'SELECT t1.col_int, (SELECT COUNT(t2.col_int) FROM ' . PlatformEntity::class . ' t2) FROM %s t1',
3839+
'mysql' => self::int(),
3840+
'sqlite' => self::int(),
3841+
'pdo_pgsql' => self::int(),
3842+
'pgsql' => self::int(),
3843+
'mssql' => self::int(),
3844+
'mysqlResult' => 9,
3845+
'sqliteResult' => 9,
3846+
'pdoPgsqlResult' => 9,
3847+
'pgsqlResult' => 9,
3848+
'mssqlResult' => 9,
3849+
'stringify' => self::STRINGIFY_NONE,
3850+
];
3851+
38363852
yield 'COUNT(t.col_int)' => [
38373853
'data' => self::dataDefault(),
38383854
'select' => 'SELECT COUNT(t.col_int) FROM %s t',

0 commit comments

Comments
 (0)