Skip to content

Relay agnostic #89

@VincentClair

Description

@VincentClair

Hello,

As GraphQL client, we use actually Apollo, which is more flexible. So we doesn't need to use Relay specificities. For example, we doesn't want to use "relay-mutation-input" and "relay-mutation-payload" for mutations.

But actually, it doesn't work. It seems that any configuration I put in payload, the returned object need a clientMutationId:

{
  "code": 500,
  "message": "Neither the property \"clientMutationId\" nor one of the methods \"addClientMutationId()\"/\"removeClientMutationId()\", \"setClientMutationId()\", \"clientMutationId()\", \"__set()\" or \"__call()\" exist and have public access in class \"Page\".",
  "errors": null
}

Here is my configuration:

Mutation:
    type: object
    config:
        fields:
            createPage:
                builder: Mutation
                builderConfig:
                    inputType: 'pageMutationInput'
                    payloadType: 'Page!' #Here I try many things as directly the Page object or pageMutationPayload
                    mutateAndGetPayload: |
                        @=service("page_manager").create(
                            service("form.factory")
                            .createNamed(null, "PageType")
                            .submit(args['input']).getData()
                        )

pageMutationInput:
    type: input-object
    config:
        fields:
            path:
                type: 'String'
                description: 'Page url.'
            view_id:
                type: 'Int!'
                description: 'View ID.'

pageMutationPayload:
    type: input-object # Is there another type that suits best ?
    config:
        fields:
            page: { type: 'Page!' }

And here is my mutation call:

mutation CreatePage {
  createPage(input: {view_id: 1, path: "myPage1.html"}) {
    	id
    	path
    	view {
        id
      }
  }
}

As a subsidiary question: The manager needs to get a object of type "Page" , so i use Form to create it with arguments from mutation. Is there something easier to configure for mutateAndGetPayload property?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions