1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of Packy. |
5
|
|
|
* |
6
|
|
|
* (c) Peter Nijssen |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace AppBundle\Command; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Console\Command\Command; |
15
|
|
|
use Symfony\Component\Console\Input\ArrayInput; |
16
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
17
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
18
|
|
|
|
19
|
|
|
class InstallCommand extends Command |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* Configure the command. |
23
|
|
|
*/ |
24
|
|
|
protected function configure() |
25
|
|
|
{ |
26
|
|
|
$this |
27
|
|
|
->setName('packy:install') |
28
|
|
|
->setDescription('Install packy'); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Execute the command. |
33
|
|
|
* |
34
|
|
|
* @param InputInterface $input |
35
|
|
|
* @param OutputInterface $output |
36
|
|
|
* |
37
|
|
|
* @throws \Exception |
38
|
|
|
*/ |
39
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
40
|
|
|
{ |
41
|
|
|
$command = $this->getApplication()->find('doctrine:database:create'); |
42
|
|
|
$arguments = [ |
43
|
|
|
'command' => 'doctrine:database:create', |
44
|
|
|
'--if-not-exists' => true, |
45
|
|
|
'--quiet' => true, |
46
|
|
|
]; |
47
|
|
|
$input = new ArrayInput($arguments); |
48
|
|
|
$input->setInteractive(false); |
49
|
|
|
$command->run($input, $output); |
50
|
|
|
|
51
|
|
|
$command = $this->getApplication()->find('doctrine:migrations:migrate'); |
52
|
|
|
$arguments = [ |
53
|
|
|
'command' => 'doctrine:migrations:migrate', |
54
|
|
|
'--quiet' => true, |
55
|
|
|
]; |
56
|
|
|
$input = new ArrayInput($arguments); |
57
|
|
|
$input->setInteractive(false); |
58
|
|
|
$command->run($input, $output); |
59
|
|
|
|
60
|
|
|
$userCommand = $this->getApplication()->find('fos:user:create'); |
61
|
|
|
$arguments = [ |
62
|
|
|
'command' => 'fos:user:create', |
63
|
|
|
'--super-admin' => true, |
64
|
|
|
]; |
65
|
|
|
$input = new ArrayInput($arguments); |
66
|
|
|
$userCommand->run($input, $output); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|