本文整理匯總了PHP中Doctrine_Collection::merge方法的典型用法代碼示例。如果您正苦於以下問題:PHP Doctrine_Collection::merge方法的具體用法?PHP Doctrine_Collection::merge怎麽用?PHP Doctrine_Collection::merge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine_Collection
的用法示例。
在下文中一共展示了Doctrine_Collection::merge方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getNodes
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;
}
示例2: loadCategoriesConnections
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'];
}
}
}
示例3: getSegmentItems
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;
}