public function loadMenuByCode($menuCode)
    {
        $menu = $this->loadFromMemory($menuCode);
        if (!($menu instanceof MenuInterface)) {

            /**
             * Menu generation and caching block.
             */
            $key = $this->getCacheKey($menuCode);
            $menu = $this->loadFromCache($key);
            if (!($menu instanceof MenuInterface)) {
                $menu = $this->buildMenuFromRepository($menuCode);

                $this->applyMenuChangers(
                    $menu,
                    ElcodiMenuStages::BEFORE_CACHE
                );

                $this->saveToCache(
                    $key,
                    $menu
                );
            }

            $this->applyMenuChangers(
                $menu,
                ElcodiMenuStages::AFTER_CACHE
            );

            $this->saveToMemory($menu);
        }

        return $menu;
    }
public function loadMenuByCode($menuCode)
    {
        $menu = $this->loadFromMemory($menuCode);
        if (!($menu instanceof MenuInterface)) {

            /**
             * Menu generation and caching block.
             */
            $key = $this->getCacheKey($menuCode);
            $menu = $this->loadFromCache($key);
            if (!($menu instanceof MenuInterface)) {
                $menu = $this->buildMenuFromRepository($menuCode);

                $this->applyMenuChangers(
                    $menu,
                    ElcodiMenuStages::BEFORE_CACHE
                );

                $this->saveToCache(
                    $key,
                    $menu
                );
            }

            $this->applyMenuChangers(
                $menu,
                ElcodiMenuStages::AFTER_CACHE
            );

            $this->saveToMemory($menu);
        }

        return $menu;
    }
public function loadMenuByCode ( $ menuCode ) { $ menu = $ this -> loadFromMemory ( $ menuCode ) ; if ( ! ( $ menu instanceof MenuInterface ) ) { /**
             * Menu generation and caching block.
             */ $ key = $ this -> getCacheKey ( $ menuCode ) ; $ menu = $ this -> loadFromCache ( $ key ) ; if ( ! ( $ menu instanceof MenuInterface ) ) { $ menu = $ this -> buildMenuFromRepository ( $ menuCode ) ; $ this -> applyMenuChangers ( $ menu , ElcodiMenuStages :: BEFORE_CACHE ) ; $ this -> saveToCache ( $ key , $ menu ) ; } $ this -> applyMenuChangers ( $ menu , ElcodiMenuStages :: AFTER_CACHE ) ; $ this -> saveToMemory ( $ menu ) ; } return $ menu ; }
Load menu hydration given the code.

If the menu is already loaded in local variable, return it.
Otherwise, if is saved into cache, load it and save it locally
Otherwise, generate the data, save it into cache and save it locally

@param string $menuCode Menu code

@return array Menu configuration

@throws Exception
Load menu hydration given the code .