* Recursively replaces the key "_id" (the raw id in GraphQL) by "id" (the name of the property expected by the Serializer) and flatten 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