-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathSchemaCommand.php
More file actions
55 lines (45 loc) · 1.93 KB
/
SchemaCommand.php
File metadata and controls
55 lines (45 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
declare(strict_types=1);
namespace CodeRhapsodie\DataflowBundle\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
/**
* @codeCoverageIgnore
*
* @deprecated This command is deprecated and will be removed in 6.0, use this command "code-rhapsodie:dataflow:database-schema" instead.
*/
#[AsCommand('code-rhapsodie:dataflow:dump-schema', 'Generates schema create / update SQL queries', help: <<<'TXT'
The <info>%command.name%</info> help you to generate SQL Query to create or update your database schema for this bundle
TXT)]
class SchemaCommand extends Command
{
protected function configure(): void
{
$this
->addOption('update', null, InputOption::VALUE_NONE, 'Dump only the update SQL queries.')
->addOption('connection', null, InputOption::VALUE_REQUIRED, 'Define the DBAL connection to use')
;
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$io->warning('This command is deprecated and will be removed in 6.0, use this command "code-rhapsodie:dataflow:database-schema" instead.');
$options = array_filter($input->getOptions());
// add -- before each keys
$options = array_combine(
array_map(static fn ($key) => '--'.$key, array_keys($options)),
array_values($options)
);
$options['--dump-sql'] = true;
$inputArray = new ArrayInput([
'command' => 'code-rhapsodie:dataflow:database-schema',
...$options,
]);
return $this->getApplication()->doRun($inputArray, $output);
}
}