ezplatform-graphql
ezplatform-graphql copied to clipboard
EZP-32303: As a Developer I want GraphQL allow filtering by Subtree and IsFieldEmpty
Question | Answer |
---|---|
JIRA issue | EZP-32303 |
Type | improvement |
Target eZ Platform version | v3.3 |
BC breaks | no |
Doc needed | yes |
Currently, it's not possible to filter content by Subtree (while parent location id available). I would like to add more filters, like Subtree and IsFieldEmpty.
{
content {
folders(query: {
Subtree: "/1/2/63"
IsFieldEmpty: {
target: "description"
empty: false
}
}) {
edges {
node { name }
}
}
}
}
Checklist:
- [x] Provided PR description.
- [x] Tested the solution manually.
- [x] Provided automated test coverage.
- [x] Ran PHP CS Fixer for new PHP code (use
$ composer fix-cs
). - [x] Asked for a review
let me know if 2.2
closed for improvements and I'll rebase to master
Thank you for the pull-request, @ITernovtsiy. It looks okay from a code perspective.
One note, though: there will always be limits to what can be done by manually crafting filters in graphql queries. Our answer to that is the query field, that gives you much more flexibility and keeps the content logic inside the repository. Maybe it would work for you ?
Indeed, sorry, I missed that query types are available in GraphQL, thanks @bdunogier May I close this PR? or is it still something you would like to see as a basic filter?
May I close this PR? or is it still something you would like to see as a basic filter?
I think they don't do any harm, we may as well merge them. Let's see what the @ezsystems/php-dev-team thinks about it :)
dear @ITernovtsiy ,
- can I filter by several IsFieldEmpty ?
- can I filter by several Subtrees ?
Yohann
@YohannsMonnier no, it would require an implementation of LogicalAnd and LogicalOr filters. And, query types are designed for more advanced searches like this.