1 | <?php |
||
2 | |||
3 | namespace ControleOnline\Command; |
||
4 | |||
5 | use Symfony\Component\Console\Command\Command; |
||
0 ignored issues
–
show
|
|||
6 | use Symfony\Component\Console\Input\InputInterface; |
||
0 ignored issues
–
show
The type
Symfony\Component\Console\Input\InputInterface was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
7 | use Symfony\Component\Console\Output\OutputInterface; |
||
0 ignored issues
–
show
The type
Symfony\Component\Console\Output\OutputInterface was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
8 | use Symfony\Component\Lock\LockFactory; |
||
0 ignored issues
–
show
The type
Symfony\Component\Lock\LockFactory was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
9 | use ControleOnline\Service\DatabaseSwitchService; |
||
0 ignored issues
–
show
The type
ControleOnline\Service\DatabaseSwitchService was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
10 | use Symfony\Component\Console\Input\InputArgument; |
||
0 ignored issues
–
show
The type
Symfony\Component\Console\Input\InputArgument was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
11 | use Symfony\Component\Console\Input\InputOption; |
||
0 ignored issues
–
show
The type
Symfony\Component\Console\Input\InputOption was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
12 | |||
13 | abstract class DefaultCommand extends Command |
||
14 | { |
||
15 | protected $input; |
||
16 | protected $output; |
||
17 | protected $lock; |
||
18 | protected $lockFactory; |
||
19 | protected $databaseSwitchService; |
||
20 | protected $loggerService; |
||
21 | protected $skyNetService; |
||
22 | |||
23 | abstract protected function runCommand(): int; |
||
24 | |||
25 | public function __construct(string $name) |
||
26 | { |
||
27 | parent::__construct($name); |
||
28 | $this->lock = $this->lockFactory->createLock($name); |
||
29 | $this->addOption('domain', ['d'], InputOption::VALUE_OPTIONAL, 'Database domain identifier'); |
||
30 | } |
||
31 | |||
32 | protected function execute(InputInterface $input, OutputInterface $output): int |
||
33 | { |
||
34 | $this->input = $input; |
||
35 | $this->output = $output; |
||
36 | |||
37 | $domain = $input->getOption('domain'); |
||
38 | |||
39 | if ($domain) { |
||
40 | $this->addLog(sprintf('Executando worker para o domínio: %s', $domain)); |
||
41 | $this->databaseSwitchService->switchDatabaseByDomain($domain); |
||
42 | $this->skyNetService->discoveryBotUser(); |
||
43 | return $this->runCommand(); |
||
44 | } |
||
45 | |||
46 | $domains = $this->databaseSwitchService->getAllDomains(); |
||
47 | |||
48 | foreach ($domains as $domain) { |
||
49 | $this->addLog(sprintf('Executando migrações para o domínio: %s', $domain)); |
||
50 | $this->databaseSwitchService->switchDatabaseByDomain($domain); |
||
51 | $this->skyNetService->discoveryBotUser(); |
||
52 | $this->runCommand(); |
||
53 | } |
||
54 | |||
55 | return Command::SUCCESS; |
||
56 | } |
||
57 | |||
58 | public function addLog(string|iterable $messages, int $options = 0, ?string $logName = 'integration') |
||
59 | { |
||
60 | $this->output->writeln($messages, $options); |
||
61 | $this->loggerService->getLogger($logName)->info($messages); |
||
62 | } |
||
63 | |||
64 | public function __destruct() |
||
65 | { |
||
66 | $this->lock->release(); |
||
67 | } |
||
68 | } |
||
69 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths