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;
 }
Exemplo n.º 3
0
 /**
  * @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;
 }
Exemplo n.º 4
0
 /**
  * @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;
 }
Exemplo n.º 6
0
 /**
  * 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();
 }
Exemplo n.º 7
0
 /**
  * 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();
 }
Exemplo n.º 8
0
 /**
  * @return string
  */
 private function getCacheDir()
 {
     $cacheDir = $this->kernel->getCacheDir() . '/' . 'faker';
     if (!is_dir($cacheDir)) {
         mkdir($cacheDir);
     }
     return $cacheDir;
 }
Exemplo n.º 9
0
 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);
 }
Exemplo n.º 11
0
 /**
  * @return string
  */
 protected function getLastMappingValidateFilePath()
 {
     return $this->kernel->getCacheDir() . DIRECTORY_SEPARATOR . 'dev_bundle_last_mapping_validate';
 }
Exemplo n.º 12
0
 /**
  * {@inheritDocs}
  */
 public function needsBuild()
 {
     return !file_exists($this->kernel->getCacheDir() . '/propel-classes/');
 }
Exemplo n.º 13
0
 /**
  * @return array
  */
 public function read()
 {
     $cacheScriptPath = $this->kernel->getCacheDir() . self::CACHE_SCRIPT_PATH;
     return require $cacheScriptPath;
 }
Exemplo n.º 14
0
 public function __construct(KernelInterface $kernel)
 {
     $this->kernel = $kernel;
     $this->cacheDir = $kernel->getCacheDir();
     ExtendClassLoadingUtils::registerClassLoader($this->cacheDir);
 }
Exemplo n.º 15
0
 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);
 }
Exemplo n.º 16
0
 /**
  * {@inheritdoc}
  */
 public function getCacheDir()
 {
     return $this->kernel->getCacheDir();
 }