You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
API Platform version(s) affected: 3.1.13 (main branch also affected)
Description
When using a name_converter other than the default one (for instance Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter), GraphQL queries retrieving linked entities affected by this name_converter will fail with an error message.
Example query :
query User {
user(id: "/users/${userId}") {
my_entities {
totalCount
edges {
node {
id
foo
}
}
}
}
}
Error message :
The class \"App\\Entity\\MyEntity\" cannot be retrieved from \"App\\Entity\\User\".
docker-compose up -d
docker-compose exec database psql -U app -c 'insert into my_entity select nextval('\''my_entity_id_seq'\''), u.id , '\''bar'\'' from "user" u limit 1;'
userId=$(docker-compose exec database psql -U app -c 'select id from "user"' -t|tr -d '')
curl --location 'https://localhost:3443/graphql' \
--header 'Content-Type: application/json' \
--data '{ "query": "query User {\n user(id: \"/users/'${userId}'\") {\n my_entities {\n totalCount\n edges {\n node {\n id\n foo\n }\n }\n }\n }\n}"}' -k
Possible Solution
It seems to be a problem with how the links are created : GraphQL doc tells about my_entities, but the Link shows a $link->getFromProperty()===myEntities. I couldn't understand where the links definitions come from so I could not investigate further.
But maybe the name_converter should be used at some point ?
Additional Context
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
API Platform version(s) affected: 3.1.13 (
main
branch also affected)Description
When using a
name_converter
other than the default one (for instanceSymfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter
), GraphQL queries retrieving linked entities affected by thisname_converter
will fail with an error message.Example query :
Error message :
Complete GraphQL response with stacktrace :
How to reproduce
Reproducer, with a linked entity
MyEntity
: https://github.com/pdesgarets/api-platform-reproducer/pull/1/files (starting from latest version of https://github.com/api-platform/demo).Possible Solution
It seems to be a problem with how the links are created : GraphQL doc tells about
my_entities
, but theLink
shows a$link->getFromProperty()===myEntities
. I couldn't understand where the links definitions come from so I could not investigate further.But maybe the name_converter should be used at some point ?
Additional Context
The text was updated successfully, but these errors were encountered: