Bug: update FilterHistory
When updating FilterHistory, the following error occurs. This happens in staging, and not in local environment. It is somehow connected to unique string validation in FilterHistory name (UniqueStringValidator).
Edit:
After consultation with @extkollm, this error only occurs locally.
The cause is probably in the dummy data created using the example_filter_histories.sql
file, since several entries with identical labels were defined here for the same user.
Request:
mutation {
updateFilterHistory(input: {
isFavorite: false,
id: "/tmd/api/index.php/filter_histories/2",
})
{
filterHistory {
label
filter
isFavorite
}
}
}
Error:
{"errors":[{"debugMessage":"String already exists. ID: {8}","message":"String already exists. ID: {8}","extensions":{"category":"user","status":422,"violations":[{"path":"","message":"String already exists. ID: {8}"}]},"locations":[{"line":2,"column":13}],"path":["updateFilterHistory"],"trace":[{"file":"\/www-data\/vendor\/api-platform\/core\/src\/GraphQl\/Resolver\/Stage\/ValidateStage.php","line":48,"call":"ApiPlatform\\Core\\Bridge\\Symfony\\Validator\\Validator::validate(instance of App\\Entity\\FilterHistory, array(1))"},{"file":"\/www-data\/vendor\/api-platform\/core\/src\/GraphQl\/Resolver\/Factory\/ItemMutationResolverFactory.php","line":120,"call":"ApiPlatform\\Core\\GraphQl\\Resolver\\Stage\\ValidateStage::__invoke(instance of App\\Entity\\FilterHistory, \u0027App\\Entity\\FilterHistory\u0027, \u0027update\u0027, array(6))"},{"file":"\/www-data\/vendor\/webonyx\/graphql-php\/src\/Executor\/ReferenceExecutor.php","line":632,"call":"ApiPlatform\\Core\\GraphQl\\Resolver\\Factory\\ItemMutationResolverFactory::ApiPlatform\\Core\\GraphQl\\Resolver\\Factory\\{closure}(null, array(1), 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":478,"call":"GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: Mutation, null, instance of ArrayObject(1), array(1))"},{"file":"\/www-data\/vendor\/webonyx\/graphql-php\/src\/Executor\/ReferenceExecutor.php","line":921,"call":"GraphQL\\Executor\\ReferenceExecutor::GraphQL\\Executor\\{closure}(array(0), \u0027updateFilterHistory\u0027)"},{"call":"GraphQL\\Executor\\ReferenceExecutor::GraphQL\\Executor\\{closure}(array(0), \u0027updateFilterHistory\u0027)"},{"file":"\/www-data\/vendor\/webonyx\/graphql-php\/src\/Executor\/ReferenceExecutor.php","line":923,"function":"array_reduce(array(1), instance of Closure, array(0))"},{"file":"\/www-data\/vendor\/webonyx\/graphql-php\/src\/Executor\/ReferenceExecutor.php","line":494,"call":"GraphQL\\Executor\\ReferenceExecutor::promiseReduce(array(1), instance of Closure, array(0))"},{"file":"\/www-data\/vendor\/webonyx\/graphql-php\/src\/Executor\/ReferenceExecutor.php","line":256,"call":"GraphQL\\Executor\\ReferenceExecutor::executeFieldsSerially(GraphQLType: Mutation, 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, \u0027mutation {\n updateFilterHistory(input: {\n isFavorite: false,\n id: \u0022\/tmd\/api\/index.php\/filter_histories\/2\u0022,\n })\n {\n filterHistory {\n label\n filter\n isFavorite\n }\n }\n }\u0027, 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, \u0027mutation {\n updateFilterHistory(input: {\n isFavorite: false,\n id: \u0022\/tmd\/api\/index.php\/filter_histories\/2\u0022,\n })\n {\n filterHistory {\n label\n filter\n isFavorite\n }\n }\n }\u0027, 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, \u0027mutation {\n updateFilterHistory(input: {\n isFavorite: false,\n id: \u0022\/tmd\/api\/index.php\/filter_histories\/2\u0022,\n })\n {\n filterHistory {\n label\n filter\n isFavorite\n }\n }\n }\u0027, 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":22,"call":"Symfony\\Component\\HttpKernel\\Kernel::handle(instance of Symfony\\Component\\HttpFoundation\\Request)"}]}],"data":{"updateFilterHistory":null}}
Edited by Michael Voigt