dmaicher / doctrine-test-bundle

Symfony bundle to isolate your app's doctrine database tests and improve the test performance
MIT License
1.08k stars 60 forks source link

getWrappedConnection in doctrine dbal is now deprecated #192

Closed zluiten closed 2 years ago

zluiten commented 2 years ago

The getWrappedConnection method is deprecated since 3.3.0 of the doctrine\dbal.

In case of using the StaticConnection class in userland migrating to the new method getNativeConnection() is not possible yet because the class does not implement that function.

Concerning upgrade instructions

Add Connection::getNativeConnection()

Driver and middleware connections need to implement a new method getNativeConnection() that gives access to the native database connection. Not doing so is deprecated.

Deprecate accessors for the native connection in favor of getNativeConnection()

The following methods have been deprecated:

Call getNativeConnection() to access the underlying PDO or MySQLi connection.

dmaicher commented 2 years ago

Indeed I see this deprecation when running the testsuite

  1x: Class "DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticConnection" should implement method "Doctrine\DBAL\Driver\Connection::getNativeConnection(): resource|object".
    1x in StaticConnectionFactoryTest::testCreateConnection from Tests\DAMA\DoctrineTestBundle\Doctrine\DBAL

@netiul do you want to contribute the change?

zluiten commented 2 years ago

I do. I'll create a PR