doCommand('cache:clear'); $this->addFlashTranslator('success', 'command.cacheClear'); return $this->redirect($request->headers->get('referer')); } private function doCommand($command) { $kernel = $this->getKernel(); $env = $kernel->getEnvironment(); $application = new Application($kernel); $application->setAutoExit(false); $input = new ArrayInput(array( 'command' => $command, '--env' => $env )); $output = new BufferedOutput(); $application->run($input, $output); $content = $output->fetch(); //return new Response($content); } }