Search code examples
oraclesymfonydoctrine-ormdoctrinedbal

Symfony 6 + Doctrine - How to configure Doctrine\DBAL\Driver\OCI8\Middleware\InitializeSession?


The Doctrine\DBAL\Event\Listeners\OracleSessionInit was deprecated in DBAL 3.5 (https://github.com/doctrine/dbal/blob/3.5.x/UPGRADE.md) in favor of the Doctrine\DBAL\Driver\OCI8\Middleware\InitializeSession.

How should I setup the application with a new middleware? The documentation (https://symfony.com/bundles/DoctrineBundle/2.4.x/configuration.html#oracle-db) still show an old way.

I tried to use driver_class and wrapper_class options, but it does not work.


Solution

  • oracle.listener:
            class: Doctrine\DBAL\Driver\OCI8\Middleware\InitializeSession
            tags:
                - { name: doctrine.event_listener, event: wrap }
    

    I hope this can help you.