Fehler auf mehreren Einbettungsebenen
Wenn die Anfrage mehrere Ebenen von eingebetteten Entitäten hat (zum Beispiel NewsContent > NewsItem > NewsCategory), wird der Fehler für die tiefste eingebettete Entität ausgelöst.
Beispiel Anfrage:
query {
observations{
edges{
node{
id
species
sectionEvent{_id, inspection{_id, transect{icc2}}}
}
}
}
}
Beispiel-Anfrage:
{
newsContents{
edges {
node {
_id
id
newsItem{
_id
newsCategory{
label
}
}
}
}
}
}
Beispiel-Antwort:
{
"errors": [
{
"message": "Access Denied to request property label of App\\Entity\\NewsCategory",
"extensions": {
"category": "graphql"
},
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"newsContents"
],
"trace": [
{
"file": "/www-data/src/Security/Utils/SerialisationGroupsHelper.php",
"line": 118,
"call": "GraphQL\\Error\\Error::createLocatedError('Access Denied to request property label of App\\Entity\\NewsCategory')"
},
{
"file": "/www-data/src/Security/Utils/SerialisationGroupsHelper.php",
"line": 206,
"call": "App\\Security\\Utils\\SerialisationGroupsHelper::getReadSerialisationGroups()"
},
{
"file": "/www-data/src/Security/ContextBuilder/EntityContextBuilderGraphQl.php",
"line": 82,
"call": "App\\Security\\Utils\\SerialisationGroupsHelper::addReadGroupsToContext()"
},
{
"file": "/www-data/vendor/api-platform/core/src/GraphQl/Resolver/Stage/ReadStage.php",
"line": 70,
"call": "App\\Security\\ContextBuilder\\EntityContextBuilderGraphQl::create('App\\Entity\\NewsContent', 'collection_query', array(6), true)"
},
{
"file": "/www-data/vendor/api-platform/core/src/GraphQl/Resolver/Factory/CollectionResolverFactory.php",
"line": 76,
"call": "ApiPlatform\\Core\\GraphQl\\Resolver\\Stage\\ReadStage::__invoke('App\\Entity\\NewsContent', 'App\\Entity\\NewsContent', 'collection_query', array(6))"
},
{
"file": "/www-data/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
"line": 632,
"call": "ApiPlatform\\Core\\GraphQl\\Resolver\\Factory\\CollectionResolverFactory::ApiPlatform\\Core\\GraphQl\\Resolver\\Factory\\{closure}(null, array(0), null, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
},
{
"file": "/www-data/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
"line": 555,
"call": "GraphQL\\Executor\\ReferenceExecutor::resolveOrError(instance of GraphQL\\Type\\Definition\\FieldDefinition, instance of GraphQL\\Language\\AST\\FieldNode, instance of Closure, null, null, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
},
{
"file": "/www-data/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
"line": 1247,
"call": "GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: Query, null, instance of ArrayObject(1), array(1))"
},
{
"file": "/www-data/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
"line": 257,
"call": "GraphQL\\Executor\\ReferenceExecutor::executeFields(GraphQLType: Query, null, array(0), instance of ArrayObject(1))"
},
{
"file": "/www-data/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php",
"line": 208,
"call": "GraphQL\\Executor\\ReferenceExecutor::executeOperation(instance of GraphQL\\Language\\AST\\OperationDefinitionNode, null)"
},
{
"file": "/www-data/vendor/webonyx/graphql-php/src/Executor/Executor.php",
"line": 155,
"call": "GraphQL\\Executor\\ReferenceExecutor::doExecute()"
},
{
"file": "/www-data/vendor/webonyx/graphql-php/src/GraphQL.php",
"line": 158,
"call": "GraphQL\\Executor\\Executor::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of GraphQL\\Type\\Schema, instance of GraphQL\\Language\\AST\\DocumentNode, null, null, array(0), null, null)"
},
{
"file": "/www-data/vendor/webonyx/graphql-php/src/GraphQL.php",
"line": 90,
"call": "GraphQL\\GraphQL::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of GraphQL\\Type\\Schema, '{\n newsContents{\n edges {\n node {\n _id\n id\n newsItem{\n _id\n newsCategory{\n label\n }\n }\n }\n }\n }\n}\n', null, null, array(0), null, null, null)"
},
{
"file": "/www-data/vendor/api-platform/core/src/GraphQl/Executor.php",
"line": 34,
"call": "GraphQL\\GraphQL::executeQuery(instance of GraphQL\\Type\\Schema, '{\n newsContents{\n edges {\n node {\n _id\n id\n newsItem{\n _id\n newsCategory{\n label\n }\n }\n }\n }\n }\n}\n', null, null, array(0), null, null, null)"
},
{
"file": "/www-data/vendor/api-platform/core/src/GraphQl/Action/EntrypointAction.php",
"line": 86,
"call": "ApiPlatform\\Core\\GraphQl\\Executor::executeQuery(instance of GraphQL\\Type\\Schema, '{\n newsContents{\n edges {\n node {\n _id\n id\n newsItem{\n _id\n newsCategory{\n label\n }\n }\n }\n }\n }\n}\n', null, null, array(0), null)"
},
{
"file": "/www-data/vendor/symfony/http-kernel/HttpKernel.php",
"line": 157,
"call": "ApiPlatform\\Core\\GraphQl\\Action\\EntrypointAction::__invoke(instance of Symfony\\Component\\HttpFoundation\\Request)"
},
{
"file": "/www-data/vendor/symfony/http-kernel/HttpKernel.php",
"line": 79,
"call": "Symfony\\Component\\HttpKernel\\HttpKernel::handleRaw(instance of Symfony\\Component\\HttpFoundation\\Request, 1)"
},
{
"file": "/www-data/vendor/symfony/http-kernel/Kernel.php",
"line": 195,
"call": "Symfony\\Component\\HttpKernel\\HttpKernel::handle(instance of Symfony\\Component\\HttpFoundation\\Request, 1, true)"
},
{
"file": "/www-data/web/index.php",
"line": 20,
"call": "Symfony\\Component\\HttpKernel\\Kernel::handle(instance of Symfony\\Component\\HttpFoundation\\Request)"
}
]
}
],
"data": {
"newsContents": null
}
}
Edited by Michael Voigt