ivome / graphql-relay-php

A library to help construct a graphql-php server supporting react-relay.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type does not resolve

factormaarten opened this issue · comments

Hi there,

I've implemented this library and have troube resolving Types.
Here's a gist of my code: https://gist.github.com/factormaarten/511353c716f0aade231f7160a3eef455

What I'm noticing is that up until this query it goes well:

query trades {
  trades(first:3) {
    edges {
      node
    }
  }
}

Then I simply get:

{
  "errors": [
    {
      "message": "Field \"node\" of type \"Trade\" must have a sub selection.",
      "extensions": {
        "category": "graphql"
      },
      "locations": [
        {
          "line": 4,
          "column": 7
        }
      ]
    }
  ]
}

But when I then add a subselection it fails:

query trades {
  trades(first:3) {
    edges {
      node {
        id
      }
    }
  }
}

or

query trades {
  trades(first:3) {
   	pageInfo {
      hasNextPage
    }
  }
}

Both result in:

{
  "errors": [
    {
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "trades"
      ]
    }
  ],
  "data": {
    "trades": null
  }
}

I would asume results aren't returned properly, but https://gist.github.com/factormaarten/511353c716f0aade231f7160a3eef455#file-querytype-php-L37 does give back results.

It looks like the resolveField in TradeType.php does not get called.

What am I doing wrong?

Doesn't seem related to this library here.