Description
After updating to both 2.7 and 3.0 and toggling metadata_backward_compatibility_layer: false to enable the new metadata system, the GraphQL mutation schema has changed for entity relations (ManyToOne + OneToOne). Now, rather than allowing having a mutation input type of relatedField: String, it now shows relatedField: createRelatedFieldNestedInput. This change is undocumented as far as I can see and only happens once I make the change to the new metadata layer.
How to reproduce
Entity class basic setup
#[ApiResource]
class Book {
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(nullable: false)]
private ?string $name = null;
{{ ... some extra columns ... }}
#[ORM\ManyToOne]
private ?Author $author = null
}
#[ApiResource]
class Author {
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
{{ ... some extra columns ... }}
#[ORM\Column(nullable: false)]
private ?string $authorName = null;
}
Possible Solution
Honestly, I'm not sure! I have tried being more explicit with the new metadata annotations. Out of ideas.
Additional Context
This is of course an example based on the typically documented Book/Author demos, but the entity markup matches the code I am working with on the project. I have also omitted all specific operations with the assumption that (according to the docs), all item and graphql operations are enabled by default. I also do not have any graphql specific markup in my api_platform.yaml file.
API Platform version(s) affected: 3.0.0 + 2.7.2 (w/ webonyx/graphql-php: "^14.0" (v14.11.8 installed))
Description
After updating to both 2.7 and 3.0 and toggling
metadata_backward_compatibility_layer: false
to enable the new metadata system, the GraphQL mutation schema has changed for entity relations (ManyToOne + OneToOne). Now, rather than allowing having a mutation input type ofrelatedField: String
, it now showsrelatedField: createRelatedFieldNestedInput
. This change is undocumented as far as I can see and only happens once I make the change to the new metadata layer.How to reproduce
Entity class basic setup
GraphQL Mutation Input BEFORE metadata update
GraphQL Mutation Input AFTER metadata update
Possible Solution
Honestly, I'm not sure! I have tried being more explicit with the new metadata annotations. Out of ideas.
Additional Context
This is of course an example based on the typically documented Book/Author demos, but the entity markup matches the code I am working with on the project. I have also omitted all specific operations with the assumption that (according to the docs), all item and graphql operations are enabled by default. I also do not have any graphql specific markup in my
api_platform.yaml
file.