1
+ <?php
2
+
3
+ namespace Symfony \Framework \DoctrineBundle \Command ;
4
+
5
+ use Symfony \Components \Console \Input \InputArgument ;
6
+ use Symfony \Components \Console \Input \InputOption ;
7
+ use Symfony \Components \Console \Input \InputInterface ;
8
+ use Symfony \Components \Console \Output \OutputInterface ;
9
+ use Symfony \Components \Console \Output \Output ;
10
+ use Symfony \Framework \WebBundle \Util \Filesystem ;
11
+ use Doctrine \Common \Cli \Configuration ;
12
+ use Doctrine \Common \Cli \CliController as DoctrineCliController ;
13
+
14
+ /*
15
+ * This file is part of the symfony framework.
16
+ *
17
+ * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
18
+ *
19
+ * This source file is subject to the MIT license that is bundled
20
+ * with this source code in the file LICENSE.
21
+ */
22
+
23
+ /**
24
+ * Manage the cache clearing of the Doctrine ORM.
25
+ *
26
+ * @package symfony
27
+ * @subpackage console
28
+ * @author Fabien Potencier <fabien.potencier@symfony-project.com>
29
+ * @author Jonathan H. Wage <jonwage@gmail.com>
30
+ */
31
+ class ClearCacheDoctrineCommand extends DoctrineCommand
32
+ {
33
+ /**
34
+ * @see Command
35
+ */
36
+ protected function configure ()
37
+ {
38
+ $ this
39
+ ->setName ('doctrine:clear-cache ' )
40
+ ->setDescription ('Clear cache from configured query, result and metadata drivers. ' )
41
+ ->setAliases (array ('doctrine:cc ' ))
42
+ ->addOption ('query ' , null , null , 'Clear the query cache. ' )
43
+ ->addOption ('metadata ' , null , null , 'Clear the metadata cache. ' )
44
+ ->addOption ('result ' , null , null , 'Clear the result cache. ' )
45
+ ->addOption ('id ' , null , null , 'Clear a cache entry by its id. ' )
46
+ ->addOption ('regex ' , null , null , 'Clear cache entries that match a regular expression. ' )
47
+ ->addOption ('prefix ' , null , null , 'Clear cache entries that match a prefix. ' )
48
+ ->addOption ('suffix ' , null , null , 'Clear cache entries that match a suffix. ' )
49
+ ;
50
+ }
51
+
52
+ /**
53
+ * @see Command
54
+ */
55
+ protected function execute (InputInterface $ input , OutputInterface $ output )
56
+ {
57
+ $ options = $ this ->buildDoctrineCliTaskOptions ($ input , array (
58
+ 'query ' , 'metadata ' , 'result ' , 'id ' , 'regex ' , 'prefix ' , 'suffix '
59
+ ));
60
+ $ this ->runDoctrineCliTask ('orm:clear-cache ' , $ options );
61
+ }
62
+ }
0 commit comments