コード例 #1
0
ファイル: ActionGraphQL.php プロジェクト: aeshion/ZeroPHP
 public function __invoke()
 {
     $request = $this->getRequest();
     $type = $request->query->get('type', 'query');
     $graph_ql = $request->request->get('graphql');
     $schema_query = Types::getType($type);
     if (!$schema_query) {
         throw new \Exception('不存在的查询');
     }
     $schema = new Schema(array('query' => $schema_query));
     $result = GraphQL::execute($schema, $graph_ql);
     return new JsonResponse($result);
 }