/** * load * static method to pre-load the specified settings into memory. Use this * early in execution to avoid multiple SQL calls for individual settings. * Takes either a string or an array of strings as an argument. * * @param mixed $settings * @static * @access public * @return void */ static function init($settings, $navigation, $rebuild = false) { // Implements Caching for navigation tree $cachePath = sfConfig::get('sf_cache_dir') . '/navigation_tree.cache'; if (!file_exists($cachePath)) { // Populate the Navigation Tree if (isset($settings['database']['driven']) && $settings['database']['driven']) { //Populate Tree from Database if ($rebuild || !Doctrine::getTable('csNavigationItem')->isPopulated()) { //Build Database from Existing navigation.yml file $tree = self::initDatabaseFromYaml($navigation, $rebuild); } else { //Pull from database, create navigation structure $tree = self::getNavigationTreeFromDatabase(); } } else { //Populate tree from navigation.yml $tree = self::getNavigationTreeFromYaml($navigation); } $menuTable = Doctrine::getTable('csNavigationMenu'); $menuTable->storeTree($tree); // Run the configure() method for dynamically adding branches Doctrine::getTable('csNavigationMenu')->configure(); $tree = $menuTable->restoreTree(); // Cache Tree $serialized = serialize($tree->toArray()); file_put_contents($cachePath, $serialized); } else { Doctrine::getTable('csNavigationMenu')->storeTree(self::getTree()); } self::$_settings = $settings; }