Disable Translator Cache

I am trying to disable the translator cache this way:

application / Config / config.yml

    services:
        translator.default:
            class:% translator.class%
            arguments: [@service_container, @ translator.selector, {}, {cache_dir: null, debug:% kernel.debug%}, @? session]

The cached code in the cache /dev/appDevDebugProjectContainer.php should be:

    protected function getTranslator_DefaultService ()
    {
        $ this-> services ['translator.default'] = $ instance = new \ Symfony \ Bundle \ FrameworkBundle \ Translation \ Translator ($ this, new \ Symfony \ Component \ Translation \ MessageSelector (), array ('translation.loader. php '=>' php ',' translation.loader.yml '=>' yml ',' translation.loader.xliff '=>' xliff '), array (' cache_dir '=> NULL,' debug '=> true ), $ this-> get ('session'));

        ... resources ...

        return $ instance;
    }

But I get the following code:

    protected function getTranslator_DefaultService ()
    {
        return $this->services['translator.default'] = new \Symfony\Bundle\FrameworkBundle\Translation\Translator($this, new \Symfony\Component\Translation\MessageSelector(), array('translation.loader.db' => 'db', 'translation.loader.php' => 'php', 'translation.loader.yml' => 'yml', 'translation.loader.xliff' => 'xliff'), array('cache_dir' => NULL, 'debug' => true), $this->get('session'));
    }

, .

+5
1

:

symfony/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php :

public function setOption($option, $value)
{
    $this->options[$option] = $value;
}

AppKernel.php :

public function boot()
{
    parent::boot();
    $this->container->get('translator')->setOption('cache_dir', null);
}
-6

All Articles