From 8b9d3795da0be4e030afdfe6cb3c342d4649ba48 Mon Sep 17 00:00:00 2001 From: Yassine Guedidi Date: Mon, 25 Dec 2023 11:19:39 +0100 Subject: [PATCH] Fix setSQLLogger() depreciation --- src/Wallabag/ImportBundle/Command/ImportCommand.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php index de2a8994a..9e4e11c1f 100644 --- a/src/Wallabag/ImportBundle/Command/ImportCommand.php +++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php @@ -2,6 +2,8 @@ namespace Wallabag\ImportBundle\Command; +use Doctrine\DBAL\Driver\Middleware; +use Doctrine\DBAL\Logging\Middleware as LoggingMiddleware; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Config\Definition\Exception\Exception; use Symfony\Component\Console\Command\Command; @@ -99,7 +101,11 @@ class ImportCommand extends Command } // Turning off doctrine default logs queries for saving memory - $this->entityManager->getConnection()->getConfiguration()->setSQLLogger(null); + $middlewares = $this->entityManager->getConnection()->getConfiguration()->getMiddlewares(); + $middlewaresWithoutLogging = array_filter($middlewares, function (Middleware $middleware) { + return !$middleware instanceof LoggingMiddleware; + }); + $this->entityManager->getConnection()->getConfiguration()->setMiddlewares($middlewaresWithoutLogging); if ($input->getOption('useUserId')) { $entityUser = $this->userRepository->findOneById($input->getArgument('username'));