Completed
Push — master ( 60d200...e262bd )
by Andrea
08:44
created

Fifree2dropdatabaseCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Fi\CoreBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Input\InputOption;
8
use Symfony\Component\Console\Output\OutputInterface;
9
use Symfony\Component\Console\Input\ArrayInput;
10
11
class Fifree2dropdatabaseCommand extends ContainerAwareCommand
12
{
13
14 1
    protected function configure()
15
    {
16
        $this
17 1
                ->setName('fifree2:dropdatabase')
18 1
                ->setDescription('Cancellazione database fifree')
19 1
                ->setHelp('Cancella il database e tutti i dati di fifree')
20 1
                ->addOption('force', null, InputOption::VALUE_NONE, 'Se non impostato, il comando non avrà effetto');
21 1
    }
22
23
    protected function execute(InputInterface $input, OutputInterface $output)
24
    {
25
        $force = $input->getOption('force');
26
27
        if (!$force) {
28
            echo "Specificare l'opzione --force per eseguire il comando";
29
30
            return 1;
31
        }
32
33
        $command = $this->getApplication()->find('doctrine:schema:drop');
34
        $arguments = array('command' => 'doctrine:schema:drop', '--force' => true);
35
        $inputcmd = new ArrayInput($arguments);
36
        $command->run($inputcmd, $output);
37
    }
38
}
39