protected function writeCache(array $menu) { $file = $this->kernel->getCacheDir() . '/' . self::CACHE_FILENAME; $content = sprintf('<?php return %s;', var_export($menu, true)); $fs = new Filesystem(); $fs->dumpFile($file, $content); }
/** * @return mixed */ protected function getMetadataCache() { if (empty($this->cache)) { if (is_file($cache = $this->kernel->getCacheDir() . '/' . self::CACHE_FILENAME)) { $this->cache = (require $cache); } } return $this->cache; }
/** * @return array */ public function getConfigurations() { if ($this->configuration !== null) { return $this->configuration; } $cacheFilePath = sprintf('%s/%s', $this->kernel->getCacheDir(), self::CACHE_FILE_NAME); $configuration = json_decode($this->filesystem->readFile($cacheFilePath), true); $this->configuration = $configuration; return $configuration; }
/** * @return \Symfony\Component\HttpKernel\Bundle\BundleInterface */ public function loadBundles() { $bundles = []; if (is_file($cache = $this->kernel->getCacheDir() . '/' . self::CACHE_FILENAME)) { $bundleClasses = (require $cache); } else { $bundleClasses = $this->getManagedBundleClasses(); } foreach ($bundleClasses as $bundleClass) { $bundles[] = new $bundleClass(); } return $bundles; }
/** * Resolve all bundle dependencies and return them all in a single array. * * @param KernelInterface $kernel Kernel * @param array $bundles Bundles defined by instances or namespaces * * @return Bundle[]|string[] Bundle definitions */ protected function resolveAndReturnBundleDependencies(KernelInterface $kernel, array $bundles) { $cacheFile = $kernel->getCacheDir() . '/kernelDependenciesStack.php'; if (!is_dir($kernel->getCacheDir())) { mkdir($kernel->getCacheDir(), 0777, true); } if (file_exists($cacheFile)) { return include $cacheFile; } $bundleStack = $this->originalResolveAndReturnBundleDependencies($kernel, $bundles); $this->cacheBuiltBundleStack($bundleStack, $cacheFile); return $bundleStack; }
/** * Constructor * * @param KernelInterface $kernel */ public function __construct(KernelInterface $kernel) { // register email address proxy class loader $loader = new UniversalClassLoader(); $loader->registerNamespaces([self::ENTITY_PROXY_NAMESPACE => $kernel->getCacheDir() . DIRECTORY_SEPARATOR . self::CACHED_ENTITIES_DIR_NAME]); $loader->register(); }
/** * Constructor * * @param KernelInterface $kernel */ public function __construct(KernelInterface $kernel) { // register logging hydrators class loader $loader = new ClassLoader(); $loader->addPrefix('OroLoggingHydrator\\', $kernel->getCacheDir() . DIRECTORY_SEPARATOR . 'oro_entities'); $loader->register(); }
/** * @return string */ private function getCacheDir() { $cacheDir = $this->kernel->getCacheDir() . '/' . 'faker'; if (!is_dir($cacheDir)) { mkdir($cacheDir); } return $cacheDir; }
private function getMetadataArray() { if ($this->metadataArray === null) { $cacheFilePath = sprintf('%s/%s', $this->kernel->getCacheDir(), MetadataCollection::CACHE_FILE_NAME); $content = file_get_contents($cacheFilePath); $this->metadataArray = json_decode($content, true); } return $this->metadataArray; }
private function clearDiCache() { $finder = new Finder(); $finder->in($this->kernel->getCacheDir()); $finder->name('*.php'); $finder->name('*.php.meta'); $filesystem = new Filesystem(); $filesystem->remove($finder); }
/** * @return string */ protected function getLastMappingValidateFilePath() { return $this->kernel->getCacheDir() . DIRECTORY_SEPARATOR . 'dev_bundle_last_mapping_validate'; }
/** * {@inheritDocs} */ public function needsBuild() { return !file_exists($this->kernel->getCacheDir() . '/propel-classes/'); }
/** * @return array */ public function read() { $cacheScriptPath = $this->kernel->getCacheDir() . self::CACHE_SCRIPT_PATH; return require $cacheScriptPath; }
public function __construct(KernelInterface $kernel) { $this->kernel = $kernel; $this->cacheDir = $kernel->getCacheDir(); ExtendClassLoadingUtils::registerClassLoader($this->cacheDir); }
protected function getSettingArrayFromCache() { $cacheFilePath = sprintf('%s/%s', $this->kernel->getCacheDir(), self::CACHE_FILE_NAME); $settingArray = json_decode($this->fileSystem->readFile($cacheFilePath), $assoc = true); return array_filter($settingArray); }
/** * {@inheritdoc} */ public function getCacheDir() { return $this->kernel->getCacheDir(); }