1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PWWEB\Artomator\Commands; |
4
|
|
|
|
5
|
|
|
use Illuminate\Console\Command; |
6
|
|
|
use InfyOm\Generator\Commands\RollbackGeneratorCommand as Base; |
7
|
|
|
use InfyOm\Generator\Generators\Scaffold\ViewGenerator; |
8
|
|
|
use PWWEB\Artomator\Common\CommandData; |
9
|
|
|
use PWWEB\Artomator\Generators\GraphQL\GraphQLMutationGenerator; |
10
|
|
|
use PWWEB\Artomator\Generators\GraphQL\GraphQLQueryGenerator; |
11
|
|
|
use PWWEB\Artomator\Generators\GraphQL\GraphQLSubscriptionGenerator; |
12
|
|
|
use PWWEB\Artomator\Generators\GraphQL\GraphQLTypeGenerator; |
13
|
|
|
|
14
|
|
|
class RollbackGeneratorCommand extends Base |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* The command Data. |
18
|
|
|
* |
19
|
|
|
* @var CommandData |
20
|
|
|
*/ |
21
|
|
|
public $commandData; |
22
|
|
|
/** |
23
|
|
|
* The console command name. |
24
|
|
|
* |
25
|
|
|
* @var string |
26
|
|
|
*/ |
27
|
|
|
protected $name = 'artomator:rollback'; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var Composer |
|
|
|
|
31
|
|
|
*/ |
32
|
|
|
public $composer; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Create a new command instance. |
36
|
|
|
*/ |
37
|
|
|
public function __construct() |
38
|
|
|
{ |
39
|
|
|
parent::__construct(); |
40
|
|
|
|
41
|
|
|
$this->composer = app()['composer']; |
|
|
|
|
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Execute the command. |
46
|
|
|
* |
47
|
|
|
* @return void |
48
|
|
|
*/ |
49
|
|
|
public function handle() |
50
|
|
|
{ |
51
|
|
|
if (! in_array($this->argument('type'), [ |
52
|
|
|
CommandData::$COMMAND_TYPE_API, |
53
|
|
|
CommandData::$COMMAND_TYPE_SCAFFOLD, |
54
|
|
|
CommandData::$COMMAND_TYPE_API_SCAFFOLD, |
55
|
|
|
CommandData::$COMMAND_TYPE_GRAPHQL, |
56
|
|
|
CommandData::$COMMAND_TYPE_GRAPHQL_SCAFFOLD, |
57
|
|
|
])) { |
58
|
|
|
$this->error('invalid rollback type'); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
$this->commandData = new CommandData($this, $this->argument('type')); |
|
|
|
|
62
|
|
|
$this->commandData->config->mName = $this->commandData->modelName = $this->argument('model'); |
|
|
|
|
63
|
|
|
|
64
|
|
|
$this->commandData->config->init($this->commandData, ['tableName', 'prefix', 'plural', 'views']); |
65
|
|
|
|
66
|
|
|
$views = $this->commandData->getOption('views'); |
67
|
|
|
if (! empty($views)) { |
68
|
|
|
$views = explode(',', $views); |
69
|
|
|
$viewGenerator = new ViewGenerator($this->commandData); |
70
|
|
|
$viewGenerator->rollback($views); |
71
|
|
|
|
72
|
|
|
$this->info('Generating autoload files'); |
73
|
|
|
$this->composer->dumpOptimized(); |
74
|
|
|
|
75
|
|
|
return; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
$typeGenerator = new GraphQLTypeGenerator($this->commandData); |
79
|
|
|
$typeGenerator->rollback(); |
80
|
|
|
|
81
|
|
|
$queryGenerator = new GraphQLQueryGenerator($this->commandData); |
82
|
|
|
$queryGenerator->rollback(); |
83
|
|
|
|
84
|
|
|
$mutationGenerator = new GraphQLMutationGenerator($this->commandData); |
85
|
|
|
$mutationGenerator->rollback(); |
86
|
|
|
|
87
|
|
|
if (config('pwweb.artomator.options.subscription')) { |
88
|
|
|
$subscriptionGenerator = new GraphQLSubscriptionGenerator($this->commandData); |
89
|
|
|
$subscriptionGenerator->rollback(); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
parent::handle(); |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|
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