/** * Initialize menu object * * @return void */ protected function _initMenu() { if (!$this->_menu) { $this->_menu = $this->_menuFactory->getMenuInstance(); if ($this->_cache->canUse('config')) { $cache = $this->_cache->load(self::CACHE_MENU_OBJECT); if ($cache) { $this->_menu->unserialize($cache); return; } } /* @var $director Mage_Backend_Model_Menu_Builder */ $menuBuilder = $this->_appConfig->getModelInstance('Mage_Backend_Model_Menu_Builder', array('menu' => $this->_menu, 'itemFactory' => $this->_appConfig->getModelInstance('Mage_Backend_Model_Menu_Item_Factory'))); /* @var $director Mage_Backend_Model_Menu_Director_Dom */ $director = $this->_appConfig->getModelInstance('Mage_Backend_Model_Menu_Director_Dom', array('config' => $this->_getDom(), 'factory' => $this->_appConfig, 'logger' => $this->_logger)); $director->buildMenu($menuBuilder); $this->_menu = $menuBuilder->getResult(); $this->_eventManager->dispatch('backend_menu_load_after', array('menu' => $this->_menu)); if ($this->_cache->canUse('config')) { $this->_cache->save($this->_menu->serialize(), self::CACHE_MENU_OBJECT, array(Mage_Core_Model_Config::CACHE_TAG)); } } }
public function __sleep() { if (Mage::getIsSerializable()) { $this->_moduleHelperName = get_class($this->_moduleHelper); if ($this->_submenu) { $this->_serializedSubmenu = $this->_submenu->serialize(); } return array('_parentId', '_moduleHelperName', '_sortIndex', '_dependsOnConfig', '_id', '_resource', '_path', '_action', '_dependsOnModule', '_tooltip', '_title', '_serializedSubmenu'); } else { return array_keys(get_object_vars($this)); } }
public function __sleep() { $this->_moduleHelperName = get_class($this->_moduleHelper); if ($this->_submenu) { $this->_serializedSubmenu = $this->_submenu->serialize(); } return array('_parentId', '_moduleHelperName', '_sortIndex', '_dependsOnConfig', '_id', '_resource', '_path', '_action', '_dependsOnModule', '_tooltip', '_title', '_serializedSubmenu'); }
public function testSerialize() { $this->assertNotEmpty($this->_model->serialize()); $this->_logger->expects($this->once())->method('log'); $this->_model->add($this->_items['item1']); }