Code Duplication    Length = 25-41 lines in 6 locations

Command/Proxy/ClearMetadataCacheDoctrineCommand.php 1 location

@@ 13-37 (lines=25) @@
10
/**
11
 * Command to clear the metadata cache of the various cache drivers.
12
 */
13
class ClearMetadataCacheDoctrineCommand extends MetadataCommand
14
{
15
    /**
16
     * {@inheritDoc}
17
     */
18
    protected function configure()
19
    {
20
        parent::configure();
21
22
        $this
23
            ->setName('doctrine:cache:clear-metadata')
24
            ->setDescription('Clears all metadata cache for an entity manager')
25
            ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
26
    }
27
28
    /**
29
     * {@inheritDoc}
30
     */
31
    protected function execute(InputInterface $input, OutputInterface $output)
32
    {
33
        DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
34
35
        return parent::execute($input, $output);
36
    }
37
}
38

Command/Proxy/ClearQueryCacheDoctrineCommand.php 1 location

@@ 13-37 (lines=25) @@
10
/**
11
 * Command to clear the query cache of the various cache drivers.
12
 */
13
class ClearQueryCacheDoctrineCommand extends QueryCommand
14
{
15
    /**
16
     * {@inheritDoc}
17
     */
18
    protected function configure()
19
    {
20
        parent::configure();
21
22
        $this
23
            ->setName('doctrine:cache:clear-query')
24
            ->setDescription('Clears all query cache for an entity manager')
25
            ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
26
    }
27
28
    /**
29
     * {@inheritDoc}
30
     */
31
    protected function execute(InputInterface $input, OutputInterface $output)
32
    {
33
        DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
34
35
        return parent::execute($input, $output);
36
    }
37
}
38

Command/Proxy/ClearResultCacheDoctrineCommand.php 1 location

@@ 13-37 (lines=25) @@
10
/**
11
 * Command to clear the result cache of the various cache drivers.
12
 */
13
class ClearResultCacheDoctrineCommand extends ResultCommand
14
{
15
    /**
16
     * {@inheritDoc}
17
     */
18
    protected function configure()
19
    {
20
        parent::configure();
21
22
        $this
23
            ->setName('doctrine:cache:clear-result')
24
            ->setDescription('Clears result cache for an entity manager')
25
            ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
26
    }
27
28
    /**
29
     * {@inheritDoc}
30
     */
31
    protected function execute(InputInterface $input, OutputInterface $output)
32
    {
33
        DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
34
35
        return parent::execute($input, $output);
36
    }
37
}
38

Command/Proxy/CreateSchemaDoctrineCommand.php 1 location

@@ 14-38 (lines=25) @@
11
 * Command to execute the SQL needed to generate the database schema for
12
 * a given entity manager.
13
 */
14
class CreateSchemaDoctrineCommand extends CreateCommand
15
{
16
    /**
17
     * {@inheritDoc}
18
     */
19
    protected function configure()
20
    {
21
        parent::configure();
22
23
        $this
24
            ->setName('doctrine:schema:create')
25
            ->setDescription('Executes (or dumps) the SQL needed to generate the database schema')
26
            ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
27
    }
28
29
    /**
30
     * {@inheritDoc}
31
     */
32
    protected function execute(InputInterface $input, OutputInterface $output)
33
    {
34
        DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
35
36
        return parent::execute($input, $output);
37
    }
38
}
39

Command/Proxy/DropSchemaDoctrineCommand.php 1 location

@@ 13-37 (lines=25) @@
10
/**
11
 * Command to drop the database schema for a set of classes based on their mappings.
12
 */
13
class DropSchemaDoctrineCommand extends DropCommand
14
{
15
    /**
16
     * {@inheritDoc}
17
     */
18
    protected function configure()
19
    {
20
        parent::configure();
21
22
        $this
23
            ->setName('doctrine:schema:drop')
24
            ->setDescription('Executes (or dumps) the SQL needed to drop the current database schema')
25
            ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command');
26
    }
27
28
    /**
29
     * {@inheritDoc}
30
     */
31
    protected function execute(InputInterface $input, OutputInterface $output)
32
    {
33
        DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
34
35
        return parent::execute($input, $output);
36
    }
37
}
38

Command/Proxy/RunDqlDoctrineCommand.php 1 location

@@ 13-53 (lines=41) @@
10
/**
11
 * Execute a Doctrine DQL query and output the results.
12
 */
13
class RunDqlDoctrineCommand extends RunDqlCommand
14
{
15
    /**
16
     * {@inheritDoc}
17
     */
18
    protected function configure()
19
    {
20
        parent::configure();
21
22
        $this
23
            ->setName('doctrine:query:dql')
24
            ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command')
25
            ->setHelp(<<<EOT
26
The <info>%command.name%</info> command executes the given DQL query and
27
outputs the results:
28
29
<info>php %command.full_name% "SELECT u FROM UserBundle:User u"</info>
30
31
You can also optional specify some additional options like what type of
32
hydration to use when executing the query:
33
34
<info>php %command.full_name% "SELECT u FROM UserBundle:User u" --hydrate=array</info>
35
36
Additionally you can specify the first result and maximum amount of results to
37
show:
38
39
<info>php %command.full_name% "SELECT u FROM UserBundle:User u" --first-result=0 --max-result=30</info>
40
EOT
41
        );
42
    }
43
44
    /**
45
     * {@inheritDoc}
46
     */
47
    protected function execute(InputInterface $input, OutputInterface $output)
48
    {
49
        DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
50
51
        return parent::execute($input, $output);
52
    }
53
}
54