@@ -16,28 +16,28 @@ |
||
16 | 16 | class SeedBuildCommand extends Command |
17 | 17 | { |
18 | 18 | |
19 | - protected function configure() |
|
20 | - { |
|
21 | - $this->setName('seed:build') |
|
22 | - ->setDescription('Create seeds data') |
|
23 | - ->setDefinition( |
|
24 | - new InputDefinition(array( |
|
25 | - new InputOption('class', 'c', InputOption::VALUE_REQUIRED), |
|
26 | - new InputOption('amount', 'a', InputOption::VALUE_OPTIONAL) |
|
27 | - )) |
|
28 | - ); |
|
29 | - } |
|
19 | + protected function configure() |
|
20 | + { |
|
21 | + $this->setName('seed:build') |
|
22 | + ->setDescription('Create seeds data') |
|
23 | + ->setDefinition( |
|
24 | + new InputDefinition(array( |
|
25 | + new InputOption('class', 'c', InputOption::VALUE_REQUIRED), |
|
26 | + new InputOption('amount', 'a', InputOption::VALUE_OPTIONAL) |
|
27 | + )) |
|
28 | + ); |
|
29 | + } |
|
30 | 30 | |
31 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
32 | - { |
|
31 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
32 | + { |
|
33 | 33 | |
34 | - if (!$class = $input->getOption('class')) { |
|
35 | - $output->writeln("Class Model not set"); |
|
36 | - return; |
|
37 | - } |
|
34 | + if (!$class = $input->getOption('class')) { |
|
35 | + $output->writeln("Class Model not set"); |
|
36 | + return; |
|
37 | + } |
|
38 | 38 | |
39 | - $number = $input->getOption('amount'); |
|
40 | - $class::build($number > 1 ? $number : 1); |
|
41 | - $output->writeln(sprintf("Seed %s amount %s create success!", $class, $number)); |
|
42 | - } |
|
39 | + $number = $input->getOption('amount'); |
|
40 | + $class::build($number > 1 ? $number : 1); |
|
41 | + $output->writeln(sprintf("Seed %s amount %s create success!", $class, $number)); |
|
42 | + } |
|
43 | 43 | } |
@@ -17,29 +17,29 @@ |
||
17 | 17 | class SeedResetCommand extends Command |
18 | 18 | { |
19 | 19 | |
20 | - protected function configure() |
|
21 | - { |
|
22 | - $this->setName('seed:reset') |
|
23 | - ->setDescription('Reset all seeds data') |
|
24 | - ->setDefinition( |
|
25 | - new InputDefinition(array( |
|
26 | - new InputOption('class', 'c', InputOption::VALUE_REQUIRED) |
|
27 | - )) |
|
28 | - ); |
|
29 | - } |
|
20 | + protected function configure() |
|
21 | + { |
|
22 | + $this->setName('seed:reset') |
|
23 | + ->setDescription('Reset all seeds data') |
|
24 | + ->setDefinition( |
|
25 | + new InputDefinition(array( |
|
26 | + new InputOption('class', 'c', InputOption::VALUE_REQUIRED) |
|
27 | + )) |
|
28 | + ); |
|
29 | + } |
|
30 | 30 | |
31 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
32 | - { |
|
31 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
32 | + { |
|
33 | 33 | |
34 | - if (!$class = $input->getOption('class')) { |
|
35 | - $output->writeln("Class Model not set"); |
|
36 | - return; |
|
37 | - } |
|
34 | + if (!$class = $input->getOption('class')) { |
|
35 | + $output->writeln("Class Model not set"); |
|
36 | + return; |
|
37 | + } |
|
38 | 38 | |
39 | - if($class::reset()){ |
|
40 | - $output->writeln(sprintf("Seed %s reset success!", $class)); |
|
41 | - } |
|
42 | - else |
|
43 | - $output->writeln("Command seed:reset fail to execute!"); |
|
44 | - } |
|
39 | + if($class::reset()){ |
|
40 | + $output->writeln(sprintf("Seed %s reset success!", $class)); |
|
41 | + } |
|
42 | + else |
|
43 | + $output->writeln("Command seed:reset fail to execute!"); |
|
44 | + } |
|
45 | 45 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
39 | - if($class::reset()){ |
|
39 | + if ($class::reset()) { |
|
40 | 40 | $output->writeln(sprintf("Seed %s reset success!", $class)); |
41 | 41 | } |
42 | 42 | else |
@@ -38,8 +38,8 @@ |
||
38 | 38 | |
39 | 39 | if($class::reset()){ |
40 | 40 | $output->writeln(sprintf("Seed %s reset success!", $class)); |
41 | + } else { |
|
42 | + $output->writeln("Command seed:reset fail to execute!"); |
|
41 | 43 | } |
42 | - else |
|
43 | - $output->writeln("Command seed:reset fail to execute!"); |
|
44 | 44 | } |
45 | 45 | } |
@@ -3,11 +3,6 @@ |
||
3 | 3 | namespace Frameworkless\Console; |
4 | 4 | |
5 | 5 | use Symfony\Component\Console\Application as CoreApp; |
6 | -use Symfony\Component\Console\Input\InputInterface; |
|
7 | -use Symfony\Component\Console\Output\OutputInterface; |
|
8 | -use Symfony\Component\Console\Input\InputArgument; |
|
9 | -use Symfony\Component\Console\Input\InputOption; |
|
10 | -use Symfony\Component\Finder\Finder; |
|
11 | 6 | |
12 | 7 | class Application extends CoreApp |
13 | 8 | { |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | class Application extends CoreApp |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
15 | + /** |
|
16 | 16 | * Gets the default commands that should always be available. |
17 | 17 | * |
18 | 18 | * @return array An array of default Command instances |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | // which is used when using the --help option |
24 | 24 | $defaultCommands = parent::getDefaultCommands(); |
25 | 25 | |
26 | - $defaultCommands []= new Commands\InfoCommand(); |
|
27 | - $defaultCommands []= new Commands\InstallPackagesCommand; |
|
28 | - $defaultCommands []= new Commands\SeedBuildCommand; |
|
29 | - $defaultCommands []= new Commands\SeedResetCommand; |
|
30 | - $defaultCommands []= new Commands\InstallCommand; |
|
31 | - $defaultCommands []= new \Propel\Generator\Command\ConfigConvertCommand(); |
|
32 | - $defaultCommands []= new \Propel\Generator\Command\MigrationMigrateCommand(); |
|
26 | + $defaultCommands []= new Commands\InfoCommand(); |
|
27 | + $defaultCommands []= new Commands\InstallPackagesCommand; |
|
28 | + $defaultCommands []= new Commands\SeedBuildCommand; |
|
29 | + $defaultCommands []= new Commands\SeedResetCommand; |
|
30 | + $defaultCommands []= new Commands\InstallCommand; |
|
31 | + $defaultCommands []= new \Propel\Generator\Command\ConfigConvertCommand(); |
|
32 | + $defaultCommands []= new \Propel\Generator\Command\MigrationMigrateCommand(); |
|
33 | 33 | |
34 | 34 | return $defaultCommands; |
35 | 35 | } |
@@ -23,13 +23,13 @@ |
||
23 | 23 | // which is used when using the --help option |
24 | 24 | $defaultCommands = parent::getDefaultCommands(); |
25 | 25 | |
26 | - $defaultCommands []= new Commands\InfoCommand(); |
|
27 | - $defaultCommands []= new Commands\InstallPackagesCommand; |
|
28 | - $defaultCommands []= new Commands\SeedBuildCommand; |
|
29 | - $defaultCommands []= new Commands\SeedResetCommand; |
|
30 | - $defaultCommands []= new Commands\InstallCommand; |
|
31 | - $defaultCommands []= new \Propel\Generator\Command\ConfigConvertCommand(); |
|
32 | - $defaultCommands []= new \Propel\Generator\Command\MigrationMigrateCommand(); |
|
26 | + $defaultCommands [] = new Commands\InfoCommand(); |
|
27 | + $defaultCommands [] = new Commands\InstallPackagesCommand; |
|
28 | + $defaultCommands [] = new Commands\SeedBuildCommand; |
|
29 | + $defaultCommands [] = new Commands\SeedResetCommand; |
|
30 | + $defaultCommands [] = new Commands\InstallCommand; |
|
31 | + $defaultCommands [] = new \Propel\Generator\Command\ConfigConvertCommand(); |
|
32 | + $defaultCommands [] = new \Propel\Generator\Command\MigrationMigrateCommand(); |
|
33 | 33 | |
34 | 34 | return $defaultCommands; |
35 | 35 | } |