/** * {@inheritdoc} */ public function boot() { if ($this->booted) { return; } if (!$this->configCache->isFresh()) { $this->container = $this->createContainerBuilder(); $this->container->compile(); $dumper = new PhpDumper($this->container); $cache = $dumper->dump(['namespace' => __NAMESPACE__, 'class' => 'CachedContainer', 'file' => $this->configCache->getPath()]); $this->configCache->write($cache, $this->container->getResources()); } require_once $this->configCache->getPath(); $this->container = new CachedContainer(); $this->booted = true; }
private function dumpCatalogue($locale, ConfigCacheInterface $cache) { $this->initializeCatalogue($locale); $fallbackContent = $this->getFallbackContent($this->catalogues[$locale]); $content = sprintf(<<<EOF <?php use Symfony\\Component\\Translation\\MessageCatalogue; \$catalogue = new MessageCatalogue('%s', %s); %s return \$catalogue; EOF , $locale, var_export($this->catalogues[$locale]->all(), true), $fallbackContent); $cache->write($content, $this->catalogues[$locale]->getResources()); }