43. define Resolver class
# AppBundle/Resolver/HumanResolver.php
namespace AppBundleResolver;
use OverblogGraphQLBundleDefinitionArgument;
class HumanResolver
{
public function resolveAllHumans(Argument $args): array
{
// Do something with the $args
return $this->humanRepository->findAll();
}
public function resolveHuman(string $humanId): Human
{
try {
return $this->humanRepository->findById($humanId);
} catch (HumanNotFoundException $e) {
throw new UserError('This human was eliminated', 0, $e);
}
}
}
70. Links not just for me ;)
https://www.scalablepath.com/blog/how-to-build-graphql-app-php/ - best for
begginers
https://graphql.org/
http://facebook.github.io/graphql/June2018/#sec-Language
https://graphql.org/swapi-graphql/ - play with it!
https://github.com/chentsulin/awesome-graphql
https://www.apollographql.com/