API Platform version(s) affected: 3.0.4
Description
When an entity has a getter with the same type as a relation the Link generated by the LinkFactory gets overriden by the link detected via the getter in LinkResourceMetadataCollectionFactory::mergeLinks.
How to reproduce
- Take api-platform demo app
- Add the following getter to Book.php
public function getSomeImportantReview(): Review
{
return new Review();
}
- Execute the following graphql query
{
books {
edges {
node {
id
reviews {
edges {
node {
id
}
}
}
}
}
}
}
- You should receive the following error message
"No mapping found for field 'someImportantReview' on class 'App\\Entity\\Book'.",
Possible Solution
Depending on whether this usage should be supported the Links generated by LinkFactory::createLinksFromRelations should only include doctrine relations and no relations detected by getter only.
Additional Context
API Platform version(s) affected: 3.0.4
Description
When an entity has a getter with the same type as a relation the
Linkgenerated by theLinkFactorygets overriden by the link detected via the getter inLinkResourceMetadataCollectionFactory::mergeLinks.How to reproduce
Possible Solution
Depending on whether this usage should be supported the
Linksgenerated byLinkFactory::createLinksFromRelationsshould only include doctrine relations and no relations detected by getter only.Additional Context