[make:migration] Add --nowdoc option

This commit is contained in:
Simon Solutions
2025-08-02 20:32:14 +02:00
committed by Jérôme Tamarelle
parent 08192e197e
commit ff15d3faa6
2 changed files with 16 additions and 0 deletions

View File

@@ -74,6 +74,7 @@ final class MakeMigration extends AbstractMaker implements ApplicationAwareMaker
$command
->addOption('formatted', null, InputOption::VALUE_NONE, 'Format the generated SQL')
->addOption('nowdoc', null, InputOption::VALUE_NONE, 'Use nowdoc format for generated SQL')
->addOption('configuration', null, InputOption::VALUE_OPTIONAL, 'The path of doctrine configuration file')
;
}
@@ -99,6 +100,10 @@ final class MakeMigration extends AbstractMaker implements ApplicationAwareMaker
$options[] = '--formatted';
}
if ($input->getOption('nowdoc')) {
$options[] = '--nowdoc';
}
if (null !== $configuration = $input->getOption('configuration')) {
$options[] = '--configuration='.$configuration;
}

View File

@@ -142,5 +142,16 @@ class MakeMigrationTest extends MakerTestCase
$this->assertStringContainsString('Success', $output);
}),
];
yield 'it_generates_a_nowdoc_migration' => [$this->createMakeMigrationTest()
->addRequiredPackageVersion('doctrine/doctrine-migrations-bundle', '>=3')
->run(function (MakerTestRunner $runner) {
$runner->runConsole('make:migration', [], '--nowdoc');
$output = $runner->runMaker([/* no input */]);
$this->assertStringContainsString('Success', $output);
}),
];
}
}