Created
May 2, 2013 09:25
-
-
Save basdek/5501165 to your computer and use it in GitHub Desktop.
Clear cache from Controller in Symfony2
This file contains 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 | |
// asume controller context here | |
public function cccAction() | |
{ | |
$kernel = $this->get('kernel'); | |
$application = new \Symfony\Bundle\FrameworkBundle\Console\Application($kernel); | |
$application->setAutoExit(false); | |
$options = array('command' => 'cache:clear',"--env" => 'prod', '--no-warmup' => true); | |
$application->run(new \Symfony\Component\Console\Input\ArrayInput($options)); | |
return new Response(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
crearing dev
My solutions are:
exec("php bin/console cache:clear --env=prod");
or