Doctrinebundle: Console commands: compatiblity with upcoming doctrine/dbal 3.0

Created on 9 Jun 2020  路  6Comments  路  Source: doctrine/DoctrineBundle

Due to some deprecations and the new ConnectionProvider interface we need to fix a few things to be compatible with doctrine/dbal 3.0.

See https://github.com/doctrine/dbal/pull/3956, https://github.com/doctrine/dbal/pull/4059

Also related was this fix: https://github.com/doctrine/DoctrineBundle/pull/1170

Some thoughts:

  • we will need an adapter from Symfony\Bridge\Doctrine\ManagerRegistry to Doctrine\DBAL\Tools\Console\ConnectionProvider and inject that into the 2 commands RunSqlDoctrineCommand and ImportDoctrineCommand (can we use the dbal commands directly and deprecate the proxy commands?)
  • remove usages of Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper
Ready to work on

All 6 comments

Yes, I concluded same. But like I mentioned in #1170 I don't want to change DoctrineBundle only to find dbal changed their API before release.

@ostrolucky I think now we could work on this?

Since release 2.11 I now have some deprecations related to this on some projects:

```
Other deprecation notices (1)

1x: Not passing a connection provider as the first constructor argument is deprecated
1x in Application::run from Symfony\Bundle\FrameworkBundle\Console

Yep

Since release 2.11 I now have some deprecations related to this

It also triggers an error when using the --connection parameter:

$ bin/console doctrine:query:sql --connection=someconnection 'CREATE SCHEMA IF NOT EXISTS someschema'

In RunSqlCommand.php line 108:

   Specifying a connection is only supported when a ConnectionProvider is used

With these versions:

  • doctrine/dbal 2.11.1
  • doctrine/doctrine-bundle 2.1.2

@Adirelle indeed. I proposed a fix for that issue here: https://github.com/doctrine/DoctrineBundle/pull/1226

Fixed in master

Was this page helpful?
0 / 5 - 0 ratings