makinacorpus / DbToolsBundle

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

Fix typed property must not be accessed before initialization error when using --list option #183

Closed iNem0o closed 2 weeks ago

iNem0o commented 2 weeks ago

Hello

When using the db-tools:restore --list command, in the listBackup() method the $this->restorer variable is not inited yet which lead to a fatal error. https://github.com/makinacorpus/DbToolsBundle/blob/main/src/Command/RestoreCommand.php#L97

As the restorer is inited lately in the main process https://github.com/makinacorpus/DbToolsBundle/blob/main/src/Command/RestoreCommand.php#L110

i added the same call to the factory inside the listBackups() method to fix and tests case for the --list option

pounard commented 2 weeks ago

Hello @iNem0o, thanks, your PR seems fine, please fix the minor comments and it's all good.

Pipeline failure seems unrelated, we'll see how it behave on your next push. If it continues to fail I'll pull your branch and test on my side to be sure it's completely unrelated.

iNem0o commented 2 weeks ago

Hello @pounard, I have made the requested changes as per your feedback. Let me know if there are any further adjustments needed after the CI checks.

pounard commented 2 weeks ago

@iNem0o thanks, I'll review this tomorrow.

pounard commented 2 weeks ago

@iNem0o Thanks! I'll add a line in the changelog file.