ivome/graphql-relay-php

edge's in mutation payload

tim-field opened this issue · 2 comments

Relay range add wants to have an edge as part of the payload.

I'm wondering how this feature could be implemented. I've tried to work out how other libraries are doing it, but I'm a little lost currently. Keen to hear what your think.

Oh ok I guess its going to be something to do with Relay::cursorForObjectInConnection 🤔 🛠️

ivome commented

You would have to use the edge type of the connection as the field type of the mutation payload. We implemented that via #5, which makes it possible to create and reuse the edge type. Then you can simply create the edge value in your code and return it in the mutation.
The cursor values depend on the pagination and cursor implementation of your data layer. You might be able to reuse the helper functions of this library.