/
ClearMetadataCacheDoctrineCommand.php
53 lines (43 loc) · 1.74 KB
/
ClearMetadataCacheDoctrineCommand.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace Symfony\Bundle\DoctrineBundle\Command;
use Symfony\Components\Console\Input\InputOption;
use Symfony\Components\Console\Input\InputInterface;
use Symfony\Components\Console\Output\OutputInterface;
use Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand;
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
/**
* Command to clear the metadata cache of the various cache drivers.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @author Jonathan H. Wage <jonwage@gmail.com>
*/
class ClearMetadataCacheDoctrineCommand extends MetadataCommand
{
protected function configure()
{
parent::configure();
$this
->setName('doctrine:cache:clear-metadata')
->setDescription('Clear all metadata cache for a entity manager.')
->addOption('em', null, InputOption::PARAMETER_OPTIONAL, 'The entity manager to use for this command.')
->setHelp(<<<EOT
The <info>doctrine:cache:clear-metadata</info> command clears all metadata cache for the default entity manager:
<info>./symfony doctrine:cache:clear-metadata</info>
You can also optionally specify the <comment>--em</comment> option to specify which entity manager to clear the cache for:
<info>./symfony doctrine:cache:clear-metadata --em=default</info>
EOT
);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
return parent::execute($input, $output);
}
}