Created
November 18, 2015 22:48
-
-
Save steve-todorov/d92d595504c719500acd to your computer and use it in GitHub Desktop.
A way to easily clear symfony cache without wiping out absolutely everything from the cache/ENV directory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class MyController extends Controller { | |
| public function myAction() { | |
| $finder = new Finder(); | |
| /** | |
| * @var SplFileInfo $file | |
| */ | |
| foreach($finder->name('*ProjectContainer*')->depth(0)->in($this->getParameter('kernel.cache_dir')) as $file){ | |
| unlink($file->getRealPath()); | |
| } | |
| $cache = $this->get('cache_warmer'); | |
| $cache->enableOptionalWarmers(); | |
| $cache->warmUp($this->getParameter('kernel.cache_dir')); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment