protected function getNodes($recreate = false) { if ($recreate || !self::$nodes) { $coll = new Doctrine_Collection('Structure', 'id'); self::$nodes = $coll->merge($this->getMenuItemFetchingQuery()->execute()); } return self::$nodes; }
public function loadCategoriesConnections($cats, &$dataArray) { $coll = new Doctrine_Collection('ProductGroup', 'import_code'); $allCats = Doctrine::getTable('ProductGroup')->createQuery('imported_groups')->from('ProductGroup pg')->where('pg.import_code != ?', 'NULL')->execute(); $allCats = $coll->merge($allCats); foreach ($cats as $index => $cat) { if ($allCats->contains($cat['id'])) { $cat_obj = $allCats->get($cat['id']); $dataArray['ProductGroups'][$index]['group_id'] = $cat_obj['id']; } } }
public function getSegmentItems($items, $root_level = 0, $iterations = null) { $segment = new Doctrine_Collection('csNavigationItem'); foreach ($items as $item) { $children = $this->getSegmentItems($item->getChildren(), $root_level, $iterations); // If the level is beneath this one, return the children of this object if ($item->level <= $root_level) { $segment->merge($children); } elseif (!$iterations || $item->getLevel() <= $root_level + $iterations) { $new_segment = clone $item; $new_segment->setChildren($children); $segment[] = $new_segment; } } return $segment; }