当前位置: 首页>>代码示例>>PHP>>正文


PHP Condition::mergeFromArray方法代码示例

本文整理汇总了PHP中Condition::mergeFromArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Condition::mergeFromArray方法的具体用法?PHP Condition::mergeFromArray怎么用?PHP Condition::mergeFromArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Condition的用法示例。


在下文中一共展示了Condition::mergeFromArray方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadCategoryPathsForArray

 public static function loadCategoryPathsForArray(&$productArray)
 {
     foreach ($productArray as $product) {
         $cond = lte('Category.lft', $product['Category']['lft']);
         $cond->addAnd(gte('Category.rgt', $product['Category']['rgt']));
         $conditions[] = $cond;
     }
     $filter = select(Condition::mergeFromArray($conditions, true));
     $filter->setOrder(f('Category.lft'));
     $categories = ActiveRecord::getRecordSetArray('Category', $filter);
     foreach ($productArray as &$product) {
         $product['Categories'] = array();
         $names = array();
         foreach ($categories as &$category) {
             if ($category['lft'] <= $product['Category']['lft'] && $category['rgt'] >= $product['Category']['rgt']) {
                 $product['Categories'][] =& $category;
                 $names[] = $category['name_lang'];
             }
         }
         array_shift($names);
         $product['category_path'] = implode(' > ', $names);
         $product['category_path_slash'] = implode(' / ', $names);
         $product['category_name'] = count($names) > 0 ? array_pop($names) : '';
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:25,代码来源:Product.php

示例2: select

function select()
{
    return new ARSelectFilter(Condition::mergeFromArray(func_get_args()));
}
开发者ID:saiber,项目名称:www,代码行数:4,代码来源:ARShortHand.php

示例3: loadSubConditions

 public static function loadSubConditions(ARSet $conditionSet)
 {
     $cond = array();
     foreach ($conditionSet as $condition) {
         if ($condition->hasSubConditions()) {
             $cond[] = $condition->getChildNodeCondition();
         }
     }
     if (!$cond) {
         return new ARSet();
     }
     $f = new ARSelectFilter(Condition::mergeFromArray($cond, true));
     $subConditions = ActiveRecordModel::getRecordSet(__CLASS__, $f);
     foreach ($subConditions as $condition) {
         $condition->parentNode->get()->registerSubCondition($condition);
     }
     return $subConditions;
 }
开发者ID:saiber,项目名称:livecart,代码行数:18,代码来源:DiscountCondition.php

示例4: getCondition

 /**
  * Create an ActiveRecord Condition object to use for product selection
  *
  * @return Condition
  */
 public function getCondition()
 {
     $specField = $this->filterGroup->get()->specField->get();
     // number range
     if ($specField->isSimpleNumbers()) {
         $field = new ARExpressionHandle($this->getJoinAlias() . '.value');
         $conditions = array();
         if ($this->rangeStart->get()) {
             $conditions[] = new EqualsOrMoreCond($field, $this->rangeStart->get());
         }
         if ($this->rangeEnd->get()) {
             $conditions[] = new EqualsOrLessCond($field, $this->rangeEnd->get());
         }
         $cond = Condition::mergeFromArray($conditions);
     } elseif ($specField->isDate()) {
         $field = new ARExpressionHandle($this->getJoinAlias() . '.value');
         $conditions = array();
         if ($this->rangeDateStart->get()) {
             $conditions[] = new EqualsOrMoreCond($field, $this->rangeDateStart->get());
         }
         if ($this->rangeDateEnd->get()) {
             $conditions[] = new EqualsOrLessCond($field, $this->rangeDateEnd->get());
         }
         $cond = Condition::mergeFromArray($conditions);
     } else {
         throw new ApplicationException('Filter type not supported');
     }
     return $cond;
 }
开发者ID:saiber,项目名称:livecart,代码行数:34,代码来源:Filter.php

示例5: getDateCondition

 protected function getDateCondition(ARFieldHandle $handle)
 {
     $conds = array();
     if ($this->from) {
         $conds[] = new EqualsOrMoreCond($handle, $this->from);
     }
     if ($this->to) {
         $conds[] = new EqualsOrLessCond($handle, $this->to);
     }
     if ($conds) {
         return Condition::mergeFromArray($conds);
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:13,代码来源:Report.php


注:本文中的Condition::mergeFromArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。