LexikTranslationBundle icon indicating copy to clipboard operation
LexikTranslationBundle copied to clipboard

Support for doctrine/dbal 3.X

Open Clement-B opened this issue 2 years ago • 2 comments

Hello,

In a move of upgrading my Symfony app from 5.3 to 5.4, I have encountered a compatibility issue with bundle doctrine/dbal in version 3.

How to reproduce bug :

  1. Install bundle on a fresh symfony app
  2. Configure DATABASE_URL with an invalid value (unknown database, hostname...)
  3. Clear cache

Observed result : Error while tying to conect to database SQLSTATE[HY000] [2002] ... Expected result : No error

doctrine/doctrine-bundle seems to have updated his dependencies and now use lastest stable version of docrine/dbal.

Here is the changelog of the initiale version 3 of doctrine/dbal : https://github.com/doctrine/dbal/releases/tag/3.0.0

As you can see, there is an major modification (and maybe more) that impact this bundle that is :

  1. The Doctrine\DBAL\DBALException and Doctrine\DBAL\Driver\DriverException have been renamed to Doctrine\DBAL\Exception and Doctrine\DBAL\Driver\Exception respectively.

This exception is currently used in these file (even in the last version 5.2.0) :
https://github.com/lexik/LexikTranslationBundle/blob/14f71785046bfd68dba56194a2efee2eaa35c914/Storage/DoctrineORMStorage.php#L40

Depending of time necessary to fix this issue (I fixed it locally by just replace the namespace by the new one) we could eventually add doctrine/dbal in dependency with a version fixed to ^2.5 ?

Clement-B avatar Dec 14 '21 16:12 Clement-B

@Clement-B Does it also occur when you install a blank SF 5.2? It should be easy enough to fix when we create a 5.3 and 5.4 branch and update master to work with 6 if possible, but I am a bit short on time atm.

bartmcleod avatar Dec 14 '21 20:12 bartmcleod

@Clement-B Does it also occur when you install a blank SF 5.2? It should be easy enough to fix when we create a 5.3 and 5.4 branch and update master to work with 6 if possible, but I am a bit short on time atm.

I didn't give it a try but it happened when migrating an existing app from 5.3 to 5.4. I dont have time neither to test on a fresh install, maybe I will test it if I can in a few weeks.

Clement-B avatar Dec 15 '21 13:12 Clement-B