makinacorpus / DbToolsBundle

A PHP library to backup, restore and anonymize databases
https://dbtoolsbundle.readthedocs.io
MIT License
181 stars 15 forks source link

slowly remove doctrine hard dependency #142

Closed pounard closed 7 months ago

pounard commented 7 months ago

OK, I have a plan, but we need to discuss it.

First, check https://github.com/makinacorpus/DbToolsBundle/pull/141 which unhardcode doctrine/dbal in many places.

Then, if we continue on this path, we need to remove the Doctrine\DBAL\Connection everywhere we use it, and replace it using MakinaCorpus\QueryBuilder\Bridge\Bridge instead. That's the easy one.

Now we are going to have one problem: backuppers and restorers are using Doctrine\Persistence\ManagerRegistry in order to create instances depending upon the database vendor. What I propose here would be:

By doing that, we would have no DBAL hardcoded dependency left, only the glue code for Symfony.

In the long term, future: we can implement a custom one based upon a configuration file, which would use doctrine to actually create the connection, but in the future this would help in order create a standalone docker container or package.

SimonMellerin commented 7 months ago

I totally agree with this!

SimonMellerin commented 7 months ago

For the record, here is connection params from Doctrine/Dbal/Connection: https://github.com/doctrine/dbal/blob/7fb00fdf7091a3ab0a4b6d0eed12170b4c7c2aa8/src/DriverManager.php#L46

pounard commented 7 months ago

Done !