File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments