This issue is related to #2740 and #2687, but it's different enough that I felt it deserves a separate issue.
I'm having trouble performing sub-selection queries on non-doctrine, non-resource collections. Here's an example. Say I have a very simple resource class:
/**
* @ApiResource
*/
class Book
{
/**
* @ApiProperty(identifier=true)
*
* @var string
*/
public $id;
/**
* @var Chapter[]
*/
public $chapters;
}
with Chapter is a simple POPO:
class Chapter
{
/**
* @var int
*/
public $startingPage;
/**
* @var string
*/
public $name;
}
For testing purposes I have custom data provider that serves dummy instances of books, each with several chapters. I also have a Normalizer that handles normalizing Chapters. This works well initially:

But say I want to fetch only the chapter names, I run into the following error:
Field \"chapters\" of type \"Iterable!\" must not have a sub selection.

This is a contrived example, of course, but you can imagine some of the properties on the nested object being bandwidth-heavy or expensive to compute.
I saw that there has been quite a bit of refactoring of the GraphQL code in master, but unfortunately I'm experiencing this issue with both the 2.4 branch as well as master. I also tried to go through the GraphQL code but I'll admit that it's a bit over my head.
Any guidance would be appreciated. Thanks!
This issue is related to #2740 and #2687, but it's different enough that I felt it deserves a separate issue.
I'm having trouble performing sub-selection queries on non-doctrine, non-resource collections. Here's an example. Say I have a very simple resource class:
with
Chapteris a simple POPO:For testing purposes I have custom data provider that serves dummy instances of books, each with several chapters. I also have a
Normalizerthat handles normalizingChapters. This works well initially:But say I want to fetch only the chapter names, I run into the following error:
Field \"chapters\" of type \"Iterable!\" must not have a sub selection.This is a contrived example, of course, but you can imagine some of the properties on the nested object being bandwidth-heavy or expensive to compute.
I saw that there has been quite a bit of refactoring of the GraphQL code in
master, but unfortunately I'm experiencing this issue with both the2.4branch as well asmaster. I also tried to go through the GraphQL code but I'll admit that it's a bit over my head.Any guidance would be appreciated. Thanks!