diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 28c6ce86ec..7cddee2db5 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -9,6 +9,8 @@ 'node_modules', 'vendor', 'docker', + 'public', + 'storage', ]) ; diff --git a/src/MessageHandler/MbinMessageHandler.php b/src/MessageHandler/MbinMessageHandler.php index 9b9346b7e7..e4259a77b7 100644 --- a/src/MessageHandler/MbinMessageHandler.php +++ b/src/MessageHandler/MbinMessageHandler.php @@ -23,16 +23,20 @@ public function __construct( */ public function workWrapper(MessageInterface $message): void { - // when we are in the test environment this would throw: ConnectionException: There is no active transaction. - if ('test' !== $this->kernel->getEnvironment()) { - $conn = $this->entityManager->getConnection(); - $conn->getNativeConnection(); // calls connect() internally - - $conn->transactional(fn () => $this->doWork($message)); - - $conn->close(); - } else { - $this->doWork($message); + try { + // when we are in the test environment this would throw: ConnectionException: There is no active transaction. + if ('test' !== $this->kernel->getEnvironment()) { + $conn = $this->entityManager->getConnection(); + $conn->getNativeConnection(); // calls connect() internally + + $conn->transactional(fn () => $this->doWork($message)); + + $conn->close(); + } else { + $this->doWork($message); + } + } finally { + gc_collect_cycles(); } }