Skip to content

Commit dea7dbd

Browse files
author
Frodo Podschwadek
committed
Fix another empty field set issue
1 parent 4f69241 commit dea7dbd

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Classes/Service/ResolverService.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,14 @@ protected function resolve(
323323

324324
// Root field resolution (Query.model)
325325
//
326-
// Note that we need to check whether this is actually one of our
327-
// defined root aliases for a table to query. Only for these we can
328-
// and want to run a database query.
329-
if (is_array($root) && isset($root[0]) && in_array($root[0], $rootTables)) {
330-
$rootTable = $this->tableMapping[$root[0]];
326+
// $root is the numeric array returned by getRootFieldNames(), which
327+
// signals we are at the Query level. isset($root[0]) distinguishes this
328+
// from nested resolver calls where $root is an associative DB record.
329+
// The actual field being resolved comes from $info->fieldName — using
330+
// $root[0] would always resolve the first root field's table, breaking
331+
// queries that request multiple root fields simultaneously.
332+
if (is_array($root) && isset($root[0]) && in_array($info->fieldName, $rootTables)) {
333+
$rootTable = $this->tableMapping[$info->fieldName];
331334
$isConnection = $this->isConnectionType($info);
332335

333336
// Separate pagination args from filter args

0 commit comments

Comments
 (0)