Skip to content

Commit

Permalink
Merge pull request #649 from geoidesic/2.next
Browse files Browse the repository at this point in the history
Make the list of commands run by AllCommands a property
  • Loading branch information
markstory authored May 10, 2020
2 parents ba241e0 + 91e9ab1 commit afa97aa
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/Command/AllCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@
*/
class AllCommand extends BakeCommand
{
/**
* All commands to call.
*
* @var string[]
*/
protected $commands = [
ModelCommand::class,
ControllerCommand::class,
TemplateCommand::class,
];

/**
* Gets the option parser instance and configures it.
*
Expand Down Expand Up @@ -83,13 +94,10 @@ public function execute(Arguments $args, ConsoleIo $io): ?int
$tables = [$name];
}

$commands = [
new ModelCommand(),
new ControllerCommand(),
new TemplateCommand(),
];
foreach ($tables as $table) {
foreach ($commands as $command) {
foreach ($this->commands as $commandName) {
/** @var \Cake\Command\Command $command */
$command = new $commandName();
foreach ($tables as $table) {
$subArgs = new Arguments([$table], $args->getOptions(), ['name']);
$command->execute($subArgs, $io);
}
Expand Down

0 comments on commit afa97aa

Please sign in to comment.