本文整理汇总了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;
}