Create a Custom GraphQl - Part 2: Create and use mutation | Magento 2

Опубликовано: 21 Июль 2026
на канале: Know the Mage
352
9

In previous video we talked about creating custom GraphQl query and using it. Now we will discuss on saving and updating the data using mutation. Learn how to create your own mutation and perform create and update operations.
Structure of mutation:
The keyword mutation
The mutation name
The input object or attributes
The output object, which specifies which data to be returned

Chapters:

0:00 Create and use custom mutation
0:04 Add createPost mutation schema
01:06 Add createPostInput mutation input
01:48 Create a CreatePost resolver class
02:33 Create a CreatePost model class
03:35 Validate the input data
04:41 Save input data
06:37 Instantiate the CreatePost model and process input data
08:19 Implement mutation
10:21 End

Subscribe to stay tuned:    / @knowthemage