{"action":"created","issue":{"url":"https://api.github.com/repos/webonyx/graphql-php/issues/11","labels_url":"https://api.github.com/repos/webonyx/graphql-php/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/webonyx/graphql-php/issues/11/comments","events_url":"https://api.github.com/repos/webonyx/graphql-php/issues/11/events","html_url":"https://github.com/webonyx/graphql-php/issues/11","id":116433232,"number":11,"title":"Mutations with Relay (React)","user":{"login":"chrissm79","id":1976169,"avatar_url":"https://avatars.githubusercontent.com/u/1976169?v=3","gravatar_id":"","url":"https://api.github.com/users/chrissm79","html_url":"https://github.com/chrissm79","followers_url":"https://api.github.com/users/chrissm79/followers","following_url":"https://api.github.com/users/chrissm79/following{/other_user}","gists_url":"https://api.github.com/users/chrissm79/gists{/gist_id}","starred_url":"https://api.github.com/users/chrissm79/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrissm79/subscriptions","organizations_url":"https://api.github.com/users/chrissm79/orgs","repos_url":"https://api.github.com/users/chrissm79/repos","events_url":"https://api.github.com/users/chrissm79/events{/privacy}","received_events_url":"https://api.github.com/users/chrissm79/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-11-11T22:16:59Z","updated_at":"2016-01-24T04:26:42Z","closed_at":"2015-11-12T15:39:37Z","body":"I'm using the [laravel-graphql] (https://github.com/Folkloreatelier/laravel-graphql#eager-loading-relationships), and created an [issue] (https://github.com/Folkloreatelier/laravel-graphql/issues/17#issuecomment-155924524) but I'm not sure if it's something that should actually be created here (still trying to wrap my head around GraphQL).\r\n\r\nWhen working with Relay, it expects that mutations have only one argument called input. Looking at the todo example, in the [schema.json] (https://github.com/facebook/relay/blob/master/examples/todo/data/schema.json#L498-L523) file it has that field listed as an INPUT_OBJECT type. I created the following (again, using laravel-graphql), but I'm unable to get the fields from the InputObjectType. Am I doing something wrong?\r\n\r\n```php\r\nnamespace App\\GraphQL\\Mutations;\r\n\r\nuse GraphQL;\r\nuse App\\Models\\Customer;\r\nuse GraphQL\\Type\\Definition\\Type;\r\nuse GraphQL\\Type\\Definition\\InputObjectType;\r\nuse Folklore\\GraphQL\\Support\\Mutation;\r\n\r\nclass UpdateCustomerEmail extends Mutation\r\n{\r\n    /**\r\n     * Associated GraphQL Type.\r\n     *\r\n     * @return mixed\r\n     */\r\n    public function type()\r\n    {\r\n        return GraphQL::type('customerPayload');\r\n    }\r\n\r\n    /**\r\n     * Available arguments for mutation.\r\n     *\r\n     * @return array\r\n     */\r\n    public function args()\r\n    {\r\n        return [\r\n            'input' => [\r\n                'name' => 'input',\r\n                'type' => new InputObjectType([\r\n                    'name' => 'updateCustomerEmailInput',\r\n                    'fields' => [\r\n                        'entity_id' => [\r\n                            'name' => 'entity_id',\r\n                            'type' => Type::nonNull(Type::string())\r\n                        ],\r\n                        'email' => [\r\n                            'name' => 'email',\r\n                            'type' => Type::nonNull(Type::string())\r\n                        ]\r\n                    ]\r\n                ])\r\n            ]\r\n        ];\r\n    }\r\n\r\n    /**\r\n     * Resolve mutation.\r\n     *\r\n     * @param  string $root\r\n     * @param  array $args\r\n     * @return Customer\r\n     */\r\n    public function resolve($root, $args, $info)\r\n    {\r\n        // $root is null, $args is an empty array and nothing in $info gives me the \r\n        // variables passed in the request\r\n        $customer = Customer::find($args['input']['entity_id']); // $args['input'] is not set\r\n        $customer->email = $args['input']['email'];\r\n        return $customer;\r\n    }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/webonyx/graphql-php/issues/comments/174248631","html_url":"https://github.com/webonyx/graphql-php/issues/11#issuecomment-174248631","issue_url":"https://api.github.com/repos/webonyx/graphql-php/issues/11","id":174248631,"user":{"login":"timbofield","id":1326910,"avatar_url":"https://avatars.githubusercontent.com/u/1326910?v=3","gravatar_id":"","url":"https://api.github.com/users/timbofield","html_url":"https://github.com/timbofield","followers_url":"https://api.github.com/users/timbofield/followers","following_url":"https://api.github.com/users/timbofield/following{/other_user}","gists_url":"https://api.github.com/users/timbofield/gists{/gist_id}","starred_url":"https://api.github.com/users/timbofield/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timbofield/subscriptions","organizations_url":"https://api.github.com/users/timbofield/orgs","repos_url":"https://api.github.com/users/timbofield/repos","events_url":"https://api.github.com/users/timbofield/events{/privacy}","received_events_url":"https://api.github.com/users/timbofield/received_events","type":"User","site_admin":false},"created_at":"2016-01-24T04:26:42Z","updated_at":"2016-01-24T04:26:42Z","body":"@vladar If you get a moment would you also be able to show what the corresponding Relay query would look like in [the above comment](https://github.com/webonyx/graphql-php/issues/11#issuecomment-156105837) ?\r\n\r\nI'm trying something like this currently:\r\n\r\n```json\r\n{\"query\": \"mutation M { updatePost(input: {id: 10 title: \\\"New title\\\"}) { title }} \"}\r\n```\r\n\r\nBasically I'm not sure how to pass the input argument correctly. The above complains with \r\n\r\n`Argument \"input\\ expected type UpdatePostInput! but got: {id: 10, title: \"New Title\"}.`\r\n\r\nI've got the the following mutation defined in schema so far *( sorry too much code )* \r\n\r\n```PHP\r\n    function updatePostMutation() {\r\n        return Mutation::mutationWithClientMutationId([\r\n            'name' => 'UpdatePost',\r\n            'inputFields' => [\r\n                'id' => [\r\n                    'type' => Type::id(),\r\n                ],\r\n                'title' => [\r\n                    'type' => Type::string(),\r\n                ],\r\n            ],\r\n            'outputFields' => [\r\n                'post' => [\r\n                    'type' => $this->getPostInterface(),\r\n                    'resolve' => function($payload) {\r\n                        return get_post($payload['id']);\r\n                    }\r\n                ]\r\n            ],\r\n            'mutateAndGetPayload' => function(array $input, ResolveInfo $info) {\r\n                // ... perform mutation ...\r\n                wp_update_post([\r\n                        'ID' => $input['id'],\r\n                        'post_title' => $input['title']\r\n                    ], false);\r\n\r\n                return [\r\n                    'id' => $input['id']\r\n                ];\r\n            }\r\n        ]);\r\n    }\r\n```"}}