Code Duplication    Length = 24-41 lines in 6 locations

Command/Proxy/ClearMetadataCacheDoctrineCommand.php 1 location

@@ 28-52 (lines=25) @@
25
 * @author Fabien Potencier <[email protected]>
26
 * @author Jonathan H. Wage <[email protected]>
27
 */
28
class ClearMetadataCacheDoctrineCommand extends MetadataCommand
29
{
30
    /**
31
     * {@inheritDoc}
32
     */
33
    protected function configure()
34
    {
35
        parent::configure();
36
37
        $this
38
            ->setName('doctrine:cache:clear-metadata')
39
            ->setDescription('Clears all metadata cache for an entity manager')
40
            ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46
    protected function execute(InputInterface $input, OutputInterface $output)
47
    {
48
        DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
49
50
        return parent::execute($input, $output);
51
    }
52
}
53

Command/Proxy/ClearQueryCacheDoctrineCommand.php 1 location

@@ 28-52 (lines=25) @@
25
 * @author Fabien Potencier <[email protected]>
26
 * @author Jonathan H. Wage <[email protected]>
27
 */
28
class ClearQueryCacheDoctrineCommand extends QueryCommand
29
{
30
    /**
31
     * {@inheritDoc}
32
     */
33
    protected function configure()
34
    {
35
        parent::configure();
36
37
        $this
38
            ->setName('doctrine:cache:clear-query')
39
            ->setDescription('Clears all query cache for an entity manager')
40
            ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46
    protected function execute(InputInterface $input, OutputInterface $output)
47
    {
48
        DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
49
50
        return parent::execute($input, $output);
51
    }
52
}
53

Command/Proxy/ClearResultCacheDoctrineCommand.php 1 location

@@ 28-52 (lines=25) @@
25
 * @author Fabien Potencier <[email protected]>
26
 * @author Jonathan H. Wage <[email protected]>
27
 */
28
class ClearResultCacheDoctrineCommand extends ResultCommand
29
{
30
    /**
31
     * {@inheritDoc}
32
     */
33
    protected function configure()
34
    {
35
        parent::configure();
36
37
        $this
38
            ->setName('doctrine:cache:clear-result')
39
            ->setDescription('Clears result cache for an entity manager')
40
            ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46
    protected function execute(InputInterface $input, OutputInterface $output)
47
    {
48
        DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
49
50
        return parent::execute($input, $output);
51
    }
52
}
53

Command/Proxy/RunDqlDoctrineCommand.php 1 location

@@ 28-68 (lines=41) @@
25
 * @author Fabien Potencier <[email protected]>
26
 * @author Jonathan H. Wage <[email protected]>
27
 */
28
class RunDqlDoctrineCommand extends RunDqlCommand
29
{
30
    /**
31
     * {@inheritDoc}
32
     */
33
    protected function configure()
34
    {
35
        parent::configure();
36
37
        $this
38
            ->setName('doctrine:query:dql')
39
            ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command')
40
            ->setHelp(<<<EOT
41
The <info>%command.name%</info> command executes the given DQL query and
42
outputs the results:
43
44
<info>php %command.full_name% "SELECT u FROM UserBundle:User u"</info>
45
46
You can also optional specify some additional options like what type of
47
hydration to use when executing the query:
48
49
<info>php %command.full_name% "SELECT u FROM UserBundle:User u" --hydrate=array</info>
50
51
Additionally you can specify the first result and maximum amount of results to
52
show:
53
54
<info>php %command.full_name% "SELECT u FROM UserBundle:User u" --first-result=0 --max-result=30</info>
55
EOT
56
        );
57
    }
58
59
    /**
60
     * {@inheritDoc}
61
     */
62
    protected function execute(InputInterface $input, OutputInterface $output)
63
    {
64
        DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
65
66
        return parent::execute($input, $output);
67
    }
68
}
69

Command/Proxy/RunSqlDoctrineCommand.php 1 location

@@ 28-58 (lines=31) @@
25
 * @author Fabien Potencier <[email protected]>
26
 * @author Jonathan H. Wage <[email protected]>
27
 */
28
class RunSqlDoctrineCommand extends RunSqlCommand
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>%command.name%</info> command executes the given SQL query and
42
outputs the results:
43
44
<info>php %command.full_name% "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

Command/Proxy/ImportDoctrineCommand.php 1 location

@@ 23-46 (lines=24) @@
20
 * @author Matthias Pigulla <[email protected]>
21
 * @author Sebastian Landwehr <[email protected]>
22
 */
23
class ImportDoctrineCommand extends ImportCommand
24
{
25
    /**
26
     * {@inheritDoc}
27
     */
28
    protected function configure()
29
    {
30
        parent::configure();
31
32
        $this
33
            ->setName('doctrine:database:import')
34
            ->addOption('connection', null, InputOption::VALUE_OPTIONAL, 'The connection to use for this command');
35
    }
36
37
    /**
38
     * {@inheritDoc}
39
     */
40
    protected function execute(InputInterface $input, OutputInterface $output)
41
    {
42
        DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection'));
43
44
        return parent::execute($input, $output);
45
    }
46
}
47