diff --git a/docs/en/reference/configuration.rst b/docs/en/reference/configuration.rst index 7b92c7520..6432a1c03 100644 --- a/docs/en/reference/configuration.rst +++ b/docs/en/reference/configuration.rst @@ -249,12 +249,9 @@ You can also set this option from the command line with the ``migrate`` command $ ./vendor/bin/doctrine-migrations migrate --all-or-nothing -If you have it enabled at the configuration level and want to change it for an individual migration you can -pass a value of ``0`` or ``1`` to ``--all-or-nothing``. - -.. code-block:: sh +.. note:: - $ ./vendor/bin/doctrine-migrations migrate --all-or-nothing=0 + Passing options to --all-or-nothing is deprecated from 3.7.x, and will not be allowed in 4.x Connection Configuration ------------------------ diff --git a/lib/Doctrine/Migrations/Tools/Console/ConsoleInputMigratorConfigurationFactory.php b/lib/Doctrine/Migrations/Tools/Console/ConsoleInputMigratorConfigurationFactory.php index fffc450ba..0cf8ccfcb 100644 --- a/lib/Doctrine/Migrations/Tools/Console/ConsoleInputMigratorConfigurationFactory.php +++ b/lib/Doctrine/Migrations/Tools/Console/ConsoleInputMigratorConfigurationFactory.php @@ -45,15 +45,14 @@ private function determineAllOrNothingValueFrom(InputInterface $input): bool|nul <<<'DEPRECATION' Context: Passing values to option `--all-or-nothing` Problem: Passing values is deprecated - Solution: If you need to disable the behavior, omit the option, - otherwise, pass the option without a value + Solution: how we should deal with this option being `true` in config but user want to disable it in command line for 4.x? DEPRECATION, ); } return match ($allOrNothingOption) { self::ABSENT_CONFIG_VALUE => null, - null => false, + null => true, default => (bool) $allOrNothingOption, }; } diff --git a/tests/Doctrine/Migrations/Tests/Tools/Console/Command/ExecuteCommandTest.php b/tests/Doctrine/Migrations/Tests/Tools/Console/Command/ExecuteCommandTest.php index e0216358a..03a1c8318 100644 --- a/tests/Doctrine/Migrations/Tests/Tools/Console/Command/ExecuteCommandTest.php +++ b/tests/Doctrine/Migrations/Tests/Tools/Console/Command/ExecuteCommandTest.php @@ -172,7 +172,7 @@ public function testExecuteCancel(): void self::assertSame(1, $this->executeCommandTester->getStatusCode()); } - public function testExecuteAllOrNothingDefaultsToFalse(): void + public function testExecuteAllOrNothingDefaultsToTrue(): void { $this->executeCommandTester->setInputs(['yes']); @@ -180,7 +180,7 @@ public function testExecuteAllOrNothingDefaultsToFalse(): void ->expects(self::once()) ->method('migrate') ->willReturnCallback(static function (MigrationPlanList $planList, MigratorConfiguration $configuration): array { - self::assertFalse($configuration->isAllOrNothing()); + self::assertTrue($configuration->isAllOrNothing()); return ['A']; }); diff --git a/tests/Doctrine/Migrations/Tests/Tools/Console/Command/MigrateCommandTest.php b/tests/Doctrine/Migrations/Tests/Tools/Console/Command/MigrateCommandTest.php index dd3876f71..32778a81d 100644 --- a/tests/Doctrine/Migrations/Tests/Tools/Console/Command/MigrateCommandTest.php +++ b/tests/Doctrine/Migrations/Tests/Tools/Console/Command/MigrateCommandTest.php @@ -381,7 +381,7 @@ public static function allOrNothing(): Generator yield [false, ['--all-or-nothing' => true], true]; yield [false, ['--all-or-nothing' => 1], true]; yield [false, ['--all-or-nothing' => '1'], true]; - yield [false, ['--all-or-nothing' => null], false, false]; + yield [false, ['--all-or-nothing' => null], true, false]; yield [true, ['--all-or-nothing' => false], false]; yield [true, ['--all-or-nothing' => 0], false];