-
Notifications
You must be signed in to change notification settings - Fork 223
Description
I'm trying to understand core concepts of this bundle.
Could you please validate or invalidate my knowledge about it please ?
First, overblog/GraphQLBundle does not use directly persistence layer (or doctrine service - different from https://github.com/4rthem/graphql-mapper (-bundle) that it seems hardly couple with Doctrine). It uses services as resolver to fetch data (from database using doctrine or not, in memory, etc.).
In code examples, where it is called $humans = StarWarsData::humans();
, I had to replace this by my entity repository for exemple.
In resolveFriend methods, I could replace StarWarsData::getFriends($character);
by $character->getFriends()
in traditional Symfony/Entity/Doctrine way.
As soon as i have a property with a listOf personal type, defining a object, i have to set a resolver, to tell bundle how to retreive data.
If I would like to expose the full list of my Characters, i declare the following Query object:
# This implements the following type system shorthand:
# type Query {
# characters(limit: Int, offset: Int, orderBy: String): [Character]
# }
#
Query:
type: object
config:
description: "Full list of characters in the Star Wars universe."
fields:
characters:
type: "[Character]"
args:
limit:
description: "If omitted,return 10 characters maximum"
type: "Int"
offset:
description: "If omitted, begin at 0"
type: "Int"
orderBy:
description: "If omitted, no sort applied"
type: "String"
resolve: "@=service('acme_bundle.my_service').find([args])"
I set a different resolve expression to be sure to understand the way to use it.
Thanks for your help