I am in the process of upgrading an application from Symfony 5.4 to Symfony 6.0. Along the way, I had to upgrade some doctrine libraries.
We are currently using setSQLLogger(null) to avoid having SQL logging enabled. By using the newer version of Doctrine, I am getting a warning:
The Doctrine\DBAL\Configuration::setSQLLogger method is deprecated (Use {@see setMiddlewares()} and {@see \Doctrine\DBAL\Logging\Middleware} instead.).
I could not figure out how can I replace setSQLLogger(null) with setMiddlewares so I could disable the SQL logging.
Did anyone have this issue and managed to fix it?
Thanks.
You should configure a middleware in order to accept the
NullLogger, then use it along withsetMiddlewaresmethod.So from symfony standpoint, you can do something like
Then you can inject it where you were using
setLoggerand replace that method call withsetMiddlewares.I didn't tried it myself, as we're running on older version, but I'm pretty confident this should resolve your issue.