core: GraphQL: can't filter nested objects
Hello.
I try to filter nested entities. Example:
I have the following schema: Entity 1<-* SubEntity 1<-* SubSubEntity. Each entity has string property Name.
When I add the following filter to Entity:
/**
* @ApiResource()
...
*/
class Entity
{
/**
* @ApiFilter(SearchFilter::class, properties={"name": "ipartial"})
*/
private $subEntities;
}
this query works fine:
{
entities {
subEntities (name: "Name") {
...
}
}
}
I get all the entities with filtered subEntities.
But when I add new filter:
...
/**
* @ApiFilter(SearchFilter::class, properties={"name": "ipartial"})
* @ApiFilter(SearchFilter::class, properties={"subSubEntities": "exact"})
*/
private $subEntities;
or
...
/**
* @ApiFilter(SearchFilter::class, properties={"name": "ipartial"})
* @ApiFilter(SearchFilter::class, properties={"subSubEntities.name": "ipartial"})
*/
private $subEntities;
The Schema builder even doesn’t see this second filter. I suspect that the reason is that the new filter is not of scalar type, but an object.
Am I doing something wrong or it’s a bug?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (16 by maintainers)
Yes, thanks @alanpoulain . I already use your commit in my development, it works fine.