@@ 12-59 (lines=48) @@ | ||
9 | use Symfony\Component\Console\Input\InputInterface; |
|
10 | use Symfony\Component\Console\Output\OutputInterface; |
|
11 | ||
12 | class BuildCommand extends Command |
|
13 | { |
|
14 | /** |
|
15 | * @var ProjectBuildManager |
|
16 | */ |
|
17 | private $projectBuildManager; |
|
18 | ||
19 | /** |
|
20 | * @var Project |
|
21 | */ |
|
22 | private $project; |
|
23 | ||
24 | /** |
|
25 | * @param ProjectBuildManager $projectManager |
|
26 | * @param Project $project |
|
27 | */ |
|
28 | public function __construct(ProjectBuildManager $projectBuildManager, Project $project) |
|
29 | { |
|
30 | parent::__construct(); |
|
31 | ||
32 | $this->projectBuildManager = $projectBuildManager; |
|
33 | $this->project = $project; |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * {@inheritdoc} |
|
38 | */ |
|
39 | protected function configure() |
|
40 | { |
|
41 | $this |
|
42 | ->setName('build') |
|
43 | ->setDescription('Build and Reset the containers of the project') |
|
44 | ->addArgument('container', InputArgument::IS_ARRAY, 'Component names'); |
|
45 | } |
|
46 | ||
47 | /** |
|
48 | * {@inheritdoc} |
|
49 | */ |
|
50 | protected function execute(InputInterface $input, OutputInterface $output) |
|
51 | { |
|
52 | $containers = $input->getArgument('container'); |
|
53 | $this->projectBuildManager->build($this->project, $containers); |
|
54 | ||
55 | $output->writeln([ |
|
56 | 'Container(s) built and successfully reset.', |
|
57 | ]); |
|
58 | } |
|
59 | } |
|
60 |
@@ 12-60 (lines=49) @@ | ||
9 | use Symfony\Component\Console\Input\InputInterface; |
|
10 | use Symfony\Component\Console\Output\OutputInterface; |
|
11 | ||
12 | class ResetCommand extends Command |
|
13 | { |
|
14 | /** |
|
15 | * @var ProjectManager |
|
16 | */ |
|
17 | private $projectManager; |
|
18 | ||
19 | /** |
|
20 | * @var Project |
|
21 | */ |
|
22 | private $project; |
|
23 | ||
24 | /** |
|
25 | * @param ProjectManager $projectManager |
|
26 | * @param Project $project |
|
27 | */ |
|
28 | public function __construct(ProjectManager $projectManager, Project $project) |
|
29 | { |
|
30 | parent::__construct(); |
|
31 | ||
32 | $this->projectManager = $projectManager; |
|
33 | $this->project = $project; |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * {@inheritdoc} |
|
38 | */ |
|
39 | protected function configure() |
|
40 | { |
|
41 | $this |
|
42 | ->setName('reset') |
|
43 | ->setDescription('Reset the containers of the project') |
|
44 | ->addArgument('container', InputArgument::IS_ARRAY, 'Component names') |
|
45 | ; |
|
46 | } |
|
47 | ||
48 | /** |
|
49 | * {@inheritdoc} |
|
50 | */ |
|
51 | protected function execute(InputInterface $input, OutputInterface $output) |
|
52 | { |
|
53 | $containers = $input->getArgument('container'); |
|
54 | $this->projectManager->reset($this->project, $containers); |
|
55 | ||
56 | $output->writeln([ |
|
57 | 'Container(s) successfully reset.', |
|
58 | ]); |
|
59 | } |
|
60 | } |
|
61 |