vendor/symfony/src/Symfony/Bundle/DoctrineBundle/Command/Proxy/ClearQueryCacheDoctrineCommand.php
changeset 0 7f95f8617b0b
equal deleted inserted replaced
-1:000000000000 0:7f95f8617b0b
       
     1 <?php
       
     2 
       
     3 /*
       
     4  * This file is part of the Symfony package.
       
     5  *
       
     6  * (c) Fabien Potencier <fabien@symfony.com>
       
     7  *
       
     8  * For the full copyright and license information, please view the LICENSE
       
     9  * file that was distributed with this source code.
       
    10  */
       
    11 
       
    12 namespace Symfony\Bundle\DoctrineBundle\Command\Proxy;
       
    13 
       
    14 use Symfony\Component\Console\Input\InputOption;
       
    15 use Symfony\Component\Console\Input\InputInterface;
       
    16 use Symfony\Component\Console\Output\OutputInterface;
       
    17 use Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand;
       
    18 
       
    19 /**
       
    20  * Command to clear the query cache of the various cache drivers.
       
    21  *
       
    22  * @author Fabien Potencier <fabien@symfony.com>
       
    23  * @author Jonathan H. Wage <jonwage@gmail.com>
       
    24  */
       
    25 class ClearQueryCacheDoctrineCommand extends QueryCommand
       
    26 {
       
    27     protected function configure()
       
    28     {
       
    29         parent::configure();
       
    30 
       
    31         $this
       
    32             ->setName('doctrine:cache:clear-query')
       
    33             ->setDescription('Clear all query cache for a entity manager')
       
    34             ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command')
       
    35             ->setHelp(<<<EOT
       
    36 The <info>doctrine:cache:clear-query</info> command clears all query cache for
       
    37 the default entity manager:
       
    38 
       
    39 <info>php app/console doctrine:cache:clear-query</info>
       
    40 
       
    41 You can also optionally specify the <comment>--em</comment> option to specify
       
    42 which entity manager to clear the cache for:
       
    43 
       
    44 <info>php app/console doctrine:cache:clear-query --em=default</info>
       
    45 EOT
       
    46         );
       
    47     }
       
    48 
       
    49     protected function execute(InputInterface $input, OutputInterface $output)
       
    50     {
       
    51         DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
       
    52 
       
    53         return parent::execute($input, $output);
       
    54     }
       
    55 }