* Retrieves fields, recursively replaces the "_id" key (the raw id) by "id" (the name of the property expected by the Serializer) and flattens edge and node structures (pagination).
27
*/
28
private function fieldsToAttributes(ResolveInfo $info): array
29
{
30
$fields = $info->getFieldSelection(PHP_INT_MAX);
31
if (isset($fields['edges']['node'])) {
32
$fields = $fields['edges']['node'];
33
}
34
35
return $this->replaceIdKeys($fields);
36
}
37
38
private function replaceIdKeys(array $fields): array