Completed
Push — master ( e262bd...cc6d72 )
by Andrea
08:21
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 2
    protected function configure()
15
    {
16
        $this
17 2
                ->setName('fifree2:dropdatabase')
18 2
                ->setDescription('Cancellazione database fifree')
19 2
                ->setHelp('Cancella il database e tutti i dati di fifree')
20 2
                ->addOption('force', null, InputOption::VALUE_NONE, 'Se non impostato, il comando non avrà effetto');
21 2
    }
22
23 1
    protected function execute(InputInterface $input, OutputInterface $output)
24
    {
25 1
        $force = $input->getOption('force');
26
27 1
        if (!$force) {
28
            echo "Specificare l'opzione --force per eseguire il comando";
29
30
            return 1;
31
        }
32
33 1
        $command = $this->getApplication()->find('doctrine:schema:drop');
34 1
        $arguments = array('command' => 'doctrine:schema:drop', '--force' => true);
35 1
        $inputcmd = new ArrayInput($arguments);
36 1
        $command->run($inputcmd, $output);
37 1
    }
38
}
39