Exemplo n.º 1
0
 private function load($type)
 {
     $src = realpath($this->kernelRootDir . '/../src');
     $w3build = realpath($this->kernelRootDir . '/../vendor/w3build');
     $finder = new Finder();
     $finder->files()->in(array($w3build, $src))->name($type . '_menu.yml')->followLinks();
     $this->collection = new Menu\MenuCollection();
     /** @var \Symfony\Component\Finder\SplFileInfo $file */
     foreach ($finder as $file) {
         $this->createCollection(Yaml::parse(file_get_contents($file->getRealPath())));
     }
     $this->collection->build();
     if ($this->environment == 'prod') {
         $this->appCache->save('menu_' . $type, $this->collection);
     }
     return $this->collection;
 }
 /**
  * Save cache by cacheID
  *
  * @param mixed (integer|string) $cacheID
  * @param array $weathers
  */
 private function saveCache($cacheID, $weather)
 {
     $this->appCache->save($cacheID, serialize($weather), 3600);
 }