@@ 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 |
@@ 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 |
@@ 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 |
@@ 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>doctrine:query:dql</info> command executes the given DQL query and |
|
42 | outputs the results: |
|
43 | ||
44 | <info>php app/console doctrine:query:dql "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 app/console doctrine:query:dql "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 app/console doctrine:query:dql "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 |
@@ 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>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 |