RunSqlDoctrineCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 15
Ratio 100 %

Importance

Changes 0
Metric Value
dl 15
loc 15
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Doctrine Bundle
5
 *
6
 * The code was originally distributed inside the Symfony framework.
7
 *
8
 * (c) Fabien Potencier <[email protected]>
9
 * (c) Doctrine Project, Benjamin Eberlei <[email protected]>
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
namespace Saxulum\DoctrineOrmCommands\Command\Proxy;
16
17
use Symfony\Component\Console\Input\InputOption;
18
use Symfony\Component\Console\Input\InputInterface;
19
use Symfony\Component\Console\Output\OutputInterface;
20
use Doctrine\DBAL\Tools\Console\Command\RunSqlCommand;
21
22
/**
23
 * Execute a SQL query and output the results.
24
 *
25
 * @author Fabien Potencier <[email protected]>
26
 * @author Jonathan H. Wage <[email protected]>
27
 */
28 View Code Duplication
class RunSqlDoctrineCommand extends RunSqlCommand
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
{
30
    /**
31
     * {@inheritDoc}
32
     */
33
    protected function configure()
34
    {
35
        parent::configure();
36
37
        $this
38
            ->setName('doctrine:query:sql')
39
            ->addOption('connection', null, InputOption::VALUE_OPTIONAL, 'The connection to use for this command')
40
            ->setHelp(<<<EOT
41
The <info>doctrine:query:sql</info> command executes the given SQL query and
42
outputs the results:
43
44
<info>php app/console doctrine:query:sql "SELECT * from user"</info>
45
EOT
46
        );
47
    }
48
49
    /**
50
     * {@inheritDoc}
51
     */
52
    protected function execute(InputInterface $input, OutputInterface $output)
53
    {
54
        DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection'));
55
56
        return parent::execute($input, $output);
57
    }
58
}
59