Skip to main content
Version: 6.1

Mutations

In GraphQLite, mutations are created like queries.

To create a mutation, you must annotate a method in a controller with the @Mutation annotation.

For instance:

namespace App\Controller;

use TheCodingMachine\GraphQLite\Annotations\Mutation;

class ProductController
{
#[Mutation]
public function saveProduct(int $id, string $name, ?float $price = null): Product
{
// Some code that saves a product.
}
}