Newscoop\NewscoopBundle\Controller\SystemPrefController::templateCache PHP Method

templateCache() private method

Sets templates caching.
private templateCache ( string $cache_template, Symfony\Component\Translation\TranslatorInterface $translator ) : void | RedirectResponse
$cache_template string Values 1 or 0
$translator Symfony\Component\Translation\TranslatorInterface Translator
return void | Symfony\Component\HttpFoundation\RedirectResponse
    private function templateCache($cache_template, $translator)
    {
        $preferencesService = $this->container->get('system_preferences_service');
        if ($preferencesService->TemplateCacheHandler != $cache_template && $cache_template) {
            $handler = \CampTemplateCache::factory($cache_template);
            if ($handler && \CampTemplateCache::factory($cache_template)->isSupported()) {
                $preferencesService->TemplateCacheHandler = $cache_template;
                \CampTemplateCache::factory($cache_template)->clean();
            } else {
                $this->get('session')->getFlashBag()->add('error', $translator->trans('newscoop.preferences.error.cache', array('%cache%' => $cache_template), 'system_pref'));
                return $this->redirect($this->generateUrl('newscoop_newscoop_systempref_index'));
            }
        } else {
            $preferencesService->TemplateCacheHandler = $cache_template;
        }
    }