Doctrine DBAL driver middlewares
New in version 12.3
Doctrine DBAL supports custom driver middlewares since version 3. These
middlewares act as a decorator around the actual Driver
component.
Subsequently, the Connection
, Statement
and Result
components can be
decorated as well. These middlewares must implement the
\Doctrine\
interface.
A common use case would be a middleware to implement SQL logging capabilities.
For more information on driver middlewares, see the Architecture chapter of the Doctrine DBAL documentation. Furthermore, look up the implementation of the EXT:adminpanel/Classes/Log/DoctrineSqlLoggingMiddleware.php (GitHub) in the Admin Panel system extension as an example.
Registering a new driver middleware
In this example, the custom driver middleware My
is added
to the Default
connection: