1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Kunstmaan\TranslatorBundle\Command; |
4
|
|
|
|
5
|
|
|
use Doctrine\Bundle\DoctrineBundle\Command\Proxy\DoctrineCommandHelper; |
6
|
|
|
use Doctrine\Bundle\MigrationsBundle\Command\DoctrineCommand; |
7
|
|
|
use Kunstmaan\TranslatorBundle\Service\Command\DiffCommand; |
8
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
9
|
|
|
use Symfony\Component\Console\Input\InputOption; |
10
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
11
|
|
|
|
12
|
1 |
|
if (class_exists(\Doctrine\Migrations\Tools\Console\Command\GenerateCommand::class)) { |
13
|
|
|
/** |
14
|
|
|
* Command for generate migration classes by checking the translation flag value |
15
|
|
|
* |
16
|
|
|
* @final since 5.1 |
17
|
|
|
* |
18
|
|
|
* @deprecated This class is deprecated since KunstmaanTranslatorBundle 5.2 and will be removed in 6.0. |
19
|
|
|
*/ |
20
|
|
|
class MigrationsDiffCommand extends DiffCommand |
21
|
|
|
{ |
22
|
|
|
protected function configure(): void |
23
|
|
|
{ |
24
|
|
|
parent::configure(); |
25
|
|
|
|
26
|
|
|
$this |
27
|
|
|
->setName('kuma:translator:migrations:diff') |
28
|
|
|
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command.') |
29
|
|
|
; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function execute(InputInterface $input, OutputInterface $output): ?int |
33
|
|
|
{ |
34
|
|
|
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); |
|
|
|
|
35
|
|
|
|
36
|
|
|
$configuration = $this->getMigrationConfiguration($input, $output); |
37
|
|
|
DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration); |
|
|
|
|
38
|
|
|
|
39
|
|
|
$exitCode = parent::execute($input, $output); |
40
|
|
|
|
41
|
|
|
return is_numeric($exitCode) ? (int) $exitCode : 0; |
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
} else { |
45
|
|
|
/** |
46
|
|
|
* Command for generate migration classes by checking the translation flag value |
47
|
|
|
* |
48
|
|
|
* @final since 5.1 |
49
|
|
|
* |
50
|
|
|
* @deprecated This class is deprecated since KunstmaanTranslatorBundle 5.2 and will be removed in 6.0. |
51
|
|
|
*/ |
52
|
|
|
class MigrationsDiffCommand extends DiffCommand |
|
|
|
|
53
|
|
|
{ |
54
|
|
|
protected function configure() |
55
|
|
|
{ |
56
|
|
|
parent::configure(); |
57
|
|
|
|
58
|
|
|
$this |
59
|
|
|
->setName('kuma:translator:migrations:diff') |
60
|
|
|
->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command.') |
61
|
|
|
; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function execute(InputInterface $input, OutputInterface $output) |
65
|
|
|
{ |
66
|
|
|
DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); |
67
|
|
|
|
68
|
|
|
$configuration = $this->getMigrationConfiguration($input, $output); |
69
|
|
|
DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration); |
70
|
|
|
|
71
|
|
|
$exitCode = parent::execute($input, $output); |
72
|
|
|
|
73
|
|
|
return is_numeric($exitCode) ? (int) $exitCode : 0; |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: