1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @copyright Bluz PHP Team |
5
|
|
|
* @link https://github.com/bluzphp/bluzman |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace Bluzman\Command\Db; |
9
|
|
|
|
10
|
|
|
use Bluzman\Command\AbstractCommand; |
11
|
|
|
use Exception; |
12
|
|
|
use Phinx\Console\PhinxApplication; |
|
|
|
|
13
|
|
|
use Symfony\Component\Console\Input\ArrayInput; |
|
|
|
|
14
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
|
|
|
15
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* AbstractDbCommand |
19
|
|
|
* |
20
|
|
|
* @package Bluzman\Command\Db |
21
|
|
|
* @author Anton Shevchuk |
22
|
|
|
*/ |
23
|
|
|
abstract class AbstractDbCommand extends AbstractCommand |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* @param InputInterface $input |
27
|
|
|
* @param OutputInterface $output |
28
|
|
|
* @return int |
29
|
|
|
* @throws Exception |
30
|
|
|
*/ |
31
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
32
|
|
|
{ |
33
|
|
|
$commandName = substr($this->getName(), 3); |
34
|
|
|
$arguments = $this->getDefinition()->getArguments(); |
35
|
|
|
|
36
|
|
|
$phinx = new PhinxApplication(); |
37
|
|
|
$command = $phinx->find($commandName); |
38
|
|
|
|
39
|
|
|
$phinxArguments = []; |
40
|
|
|
|
41
|
|
|
foreach ($arguments as $name => $argumentInput) { |
42
|
|
|
if ($input->getArgument($name)) { |
43
|
|
|
$phinxArguments[$name] = $input->getArgument($name); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
$phinxArguments['command'] = $commandName; |
48
|
|
|
$phinxArguments['--configuration'] = PATH_APPLICATION . DS . 'configs' . DS . 'phinx.php'; |
|
|
|
|
49
|
|
|
|
50
|
|
|
// write database name to console |
51
|
|
|
// to avoid any mistakes |
52
|
|
|
$config = include $phinxArguments['--configuration']; |
53
|
|
|
$this->write('<info>host</info> ' . $config['environments']['default']['host']); |
54
|
|
|
$this->write('<info>name</info> ' . $config['environments']['default']['name']); |
55
|
|
|
|
56
|
|
|
if ($command->getDefinition()->hasOption('environment')) { |
57
|
|
|
$phinxArguments['--environment'] = 'default'; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
$phinxInput = new ArrayInput($phinxArguments); |
61
|
|
|
return $command->run($phinxInput, $output); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|
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