thecodingmachine/tdbm-graphql-bundle

Dao class save method is not working

Rohan-Jalil opened this issue · 1 comments

When I try to save entity/model/bean through Dao , it throws me an error.

image

image

image

There is already an active transactio

#0 /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1246): PDO->beginTransaction()
#1 /var/www/html/vendor/thecodingmachine/tdbm/src/TDBMService.php(569): Doctrine\DBAL\Connection->beginTransaction()
#2 /var/www/html/src/Dao/Generated/AbstractEnsembleDao.php(58): TheCodingMachine\TDBM\TDBMService->save(Object(App\Model\Ensemble))
#3 /var/www/html/src/Controller/GraphQL/EnsemblesController.php(73): App\Dao\Generated\AbstractEnsembleDao->save(Object(App\Model\Ensemble))
#4 /var/www/html/vendor/thecodingmachine/graphqlite/src/QueryField.php(69): App\Controller\GraphQL\EnsemblesController->saveEnsemble('', 'test', 'test')
#5 /var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(613): TheCodingMachine\GraphQLite\QueryField->TheCodingMachine\GraphQLite{closure}(NULL, Array, NULL, Object(GraphQL\Type\Definition\ResolveInfo))
#6 /var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(548): GraphQL\Executor\ReferenceExecutor->resolveOrError(Object(TheCodingMachine\GraphQLite\QueryField), Object(GraphQL\Language\AST\FieldNode), Object(Closure), NULL, NULL, Object(GraphQL\Type\Definition\ResolveInfo))
#7 /var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(469): GraphQL\Executor\ReferenceExecutor->resolveField(Object(GraphQL\Type\Definition\ObjectType), NULL, Object(ArrayObject), Array)
#8 /var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(894): GraphQL\Executor\ReferenceExecutor->GraphQL\Executor{closure}(Array, 'saveEnsemble')
#9 [internal function]: GraphQL\Executor\ReferenceExecutor->GraphQL\Executor{closure}(Array, 'saveEnsemble')
#10 /var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(896): array_reduce(Array, Object(Closure), Array)
#11 /var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(483): GraphQL\Executor\ReferenceExecutor->promiseReduce(Array, Object(Closure), Array)
#12 /var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(253): GraphQL\Executor\ReferenceExecutor->executeFieldsSerially(Object(GraphQL\Type\Definition\ObjectType), NULL, Array, Object(ArrayObject))
#13 /var/www/html/vendor/webonyx/graphql-php/src/Executor/ReferenceExecutor.php(207): GraphQL\Executor\ReferenceExecutor->executeOperation(Object(GraphQL\Language\AST\OperationDefinitionNode), NULL)
#14 /var/www/html/vendor/webonyx/graphql-php/src/Executor/Executor.php(155): GraphQL\Executor\ReferenceExecutor->doExecute()
#15 /var/www/html/vendor/webonyx/graphql-php/src/GraphQL.php(165): GraphQL\Executor\Executor::promiseToExecute(Object(GraphQL\Executor\Promise\Adapter\SyncPromiseAdapter), Object(TheCodingMachine\GraphQLite\Schema), Object(GraphQL\Language\AST\DocumentNode), NULL, NULL, Array, 'saveEnsemble', NULL)
#16 /var/www/html/vendor/webonyx/graphql-php/src/Server/Helper.php(295): GraphQL\GraphQL::promiseToExecute(Object(GraphQL\Executor\Promise\Adapter\SyncPromiseAdapter), Object(TheCodingMachine\GraphQLite\Schema), Object(GraphQL\Language\AST\DocumentNode), NULL, NULL, Array, 'saveEnsemble', NULL, NULL)
#17 /var/www/html/vendor/webonyx/graphql-php/src/Server/Helper.php(202): GraphQL\Server\Helper->promiseToExecuteOperation(Object(GraphQL\Executor\Promise\Adapter\SyncPromiseAdapter), Object(GraphQL\Server\ServerConfig), Object(GraphQL\Server\OperationParams))
#18 /var/www/html/vendor/webonyx/graphql-php/src/Server/StandardServer.php(135): GraphQL\Server\Helper->executeOperation(Object(GraphQL\Server\ServerConfig), Object(GraphQL\Server\OperationParams))
#19 /var/www/html/vendor/webonyx/graphql-php/src/Server/StandardServer.php(168): GraphQL\Server\StandardServer->executeRequest(Object(GraphQL\Server\OperationParams))
#20 /var/www/html/vendor/thecodingmachine/graphqlite-bundle/Controller/GraphqliteController.php(90): GraphQL\Server\StandardServer->executePsrRequest(Object(Zend\Diactoros\ServerRequest))
#21 /var/www/html/vendor/thecodingmachine/graphqlite-bundle/Controller/GraphqliteController.php(83): TheCodingMachine\Graphqlite\Bundle\Controller\GraphqliteController->handlePsr7Request(Object(Zend\Diactoros\ServerRequest))
#22 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(150): TheCodingMachine\Graphqlite\Bundle\Controller\GraphqliteController->handleRequest(Object(Symfony\Component\HttpFoundation\Request))
#23 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(67): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#24 /var/www/html/vendor/symfony/http-kernel/Kernel.php(198): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /var/www/html/public/index.php(25): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#26 {main}1
{"data":{"saveEnsemble":{"id":"27d8d280-4ff9-11e9-a0ce-0242ac140006","nom":"test","description":"test","__typename":"Ensemble"}}}

Hey @Rohan-Jalil

I'm really sorry I did not see your issue sooner. I guess you found the solution.
For the record, it means you have somewhere else in your application something that is starting a transaction.

The last time I faced this issue, the transaction was started by a PDO handler of the session configured in Symfony, but it could be anything else really. I have to look for what could be starting transactions.