Closed endelwar closed 7 months ago
Cc @agustingomes
Proposed solution
Remove the default value of all-or-nothing option in Doctrine\Migrations\Tools\Console\Command\MigrateCommand::configure
Why not instead alter the computation of $wasOptionExplicitlyPassed
to see check if the value is notprovided
?
$input->hasOption('all-or-nothing')
does not check at all whether this option was passed. It checks whether this option is defined.
Isn't as easy as changing notprovided
to null
in Doctrine\Migrations\Tools\Console\Command\MigrateCommand::configure
Or even to remove the default value?
@gaetan-petit From my understanding, is not as easy as what you mention because of what @stof mentioned. That complicates the check a bit, as you can see in the PR you have opened with the test case that is failing.
This is what I wrote back when I did the commit adding the notprovided
:
This test case addition simulates what happens when the `--all-or-nothing` option is indicated, but no explicit value is passed.
We'll set a default option, which is retrieved in case the option has not been provided, allowing us to override the value in case the option is different than the default value.
@endelwar there's a new release available which should have this issue fixed.
Great work! thanks!
Bug Report
Summary
When running
bin/console doctrine:migrations:migrate
deprecation for passing values to--all-or-nothing
always triggers because option has default value.Current behavior
Due to https://github.com/doctrine/migrations/pull/1296 a default option for
--all-or-nothing
is always set ('notprovided'), making check on https://github.com/doctrine/migrations/blob/78484f91fef85f2d579cd0a4a662d77f3b742398/lib/Doctrine/Migrations/Tools/Console/ConsoleInputMigratorConfigurationFactory.php#L33-L34 to always set$allOrNothingOption
to a not null value, which then triggers the deprecation:How to reproduce
Run
bin/console doctrine:migrations:migrate
and look at the logsExpected behavior
I expect no deprecation triggered when not setting the
--all-or-nothing
optionProposed solution
Remove the default value of
all-or-nothing
option inDoctrine\Migrations\Tools\Console\Command\MigrateCommand::configure