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


PHP iterFirst函数代码示例

本文整理汇总了PHP中iterFirst函数的典型用法代码示例。如果您正苦于以下问题:PHP iterFirst函数的具体用法?PHP iterFirst怎么用?PHP iterFirst使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: loadScriptByName

 /**
  * Loads script by name
  *
  * @param 	string		$name	Script name
  * @return	RM_ReportScript_iScript
  */
 public function loadScriptByName($name)
 {
     if (!$name) {
         return M('Base')->null();
     }
     return iterFirst($this->storage('script')->getObjectList()->filter('name=?', $name));
 }
开发者ID:evilgeny,项目名称:bob,代码行数:13,代码来源:Mapper.class.php

示例2: mergeLeaves

 /**
  *	Merges and saves leaves (объединить пересекающиеся отпуска).
  *
  *	@return		bool
  */
 public function mergeLeaves()
 {
     $request = $this->getLeaveIntersections();
     if ($request->count() > 0) {
         $request1 = clone $request;
         $minObLeave = iterFirst($request->sort('date_from', 'ASC'));
         $maxObLeave = iterFirst($request1->sort('date_to', 'DESC'));
         $update_arr = array();
         if (strtotime($minObLeave->date_from) < strtotime($this->date_from)) {
             $update_arr['date_from'] = $minObLeave->date_from;
         }
         if (strtotime($maxObLeave->date_to) > strtotime($this->date_to)) {
             $update_arr['date_to'] = $maxObLeave->date_to;
         }
         unset($request1);
         // сначала надо удалить старые отпуска
         $deleted_leaves = array();
         foreach ($request as $item) {
             $deleted_leaves[$item->id()] = $item;
             $item->delete();
         }
         // обновить даты начала и окончания отпуска
         $this->update($update_arr);
         // вернуть массив id удаленных отпусков
         return $deleted_leaves;
     }
     return FALSE;
 }
开发者ID:evilgeny,项目名称:bob,代码行数:33,代码来源:Leave.class.php

示例3: process

 public function process(array $data, $field, RM_Base_iResult $result)
 {
     if (!isNull(iterFirst(M('Category')->getCategoryList()->filter('name=? and id!=?', $data[$field], $data['id'])))) {
         $result->error('name_not_unique', $field);
         return FALSE;
     }
     return TRUE;
 }
开发者ID:evilgeny,项目名称:bob,代码行数:8,代码来源:Unique.class.php

示例4: searchValueIntoAttribute

 public function searchValueIntoAttribute(RM_Gpc_Attribute_Object $obAttribute, $value_name)
 {
     $obValue = M('Base')->null();
     foreach (M('Gpc')->getValueList()->filter(L(NULL) . '_name = ?', $value_name)->sort('id', 'DESC') as $obValue) {
         if (!isNull(iterFirst($obAttribute->getValues()->filter('id = ?', $obValue->id())->sort('id')))) {
             break;
         }
     }
     return $obValue;
 }
开发者ID:evilgeny,项目名称:bob,代码行数:10,代码来源:Action.class.php

示例5: execute

 /**
  * @see RM_Holder_Invoice_item_State::execute()
  */
 public function execute()
 {
     $obInvoice = $this->_getExistsInvoiceOrCreate();
     $obInvoice->addEntity($this->_obItem->getEntity());
     $newItem = iterFirst($obInvoice->getItemsList()->filter('entity_id = ?', $this->_obItem->entity_id));
     $newItem->addDescription('Недостающая часть для накладной №' . $this->_obItem->getInvoice()->number);
     $newItem->save();
     $this->_obItem->addDescription('Недостающая часть в накладной №' . $obInvoice->number);
     $this->_obItem->save();
 }
开发者ID:evilgeny,项目名称:bob,代码行数:13,代码来源:Other.class.php

示例6: getSizeAsString

 /**
  * Enter description here...
  *
  * @return string
  */
 public function getSizeAsString()
 {
     $type = M('User')->getPetNameByAnimalType($this->_obFamily->animal_type);
     if (in_array($type, array('cat', 'dog'))) {
         if (!isNull($obj = iterFirst(M('Store')->requestQuery(M('Store')->factoryObject(), M('Db')->createQuery(M('user')->table($type . '_size'))->what('*')->where('id = ?', $this->_obFamily->animal_weight_id))))) {
             return $obj->name;
         }
     }
     return '';
 }
开发者ID:evilgeny,项目名称:bob,代码行数:15,代码来源:Pet.class.php

示例7: execute

 /**
  * @see RM_Holder_Invoice_Item_State::execute()
  */
 public function execute()
 {
     $this->_obItem->changeState(RM_Holder_Invoice_Item_State::KIT);
     $obBackInvoice = $this->_getExistsInvoiceOrCreate(RM_Holder_Invoice_Item_State::BACK);
     $obBackInvoice->addEntity($this->_obItem->getEntity());
     $backItem = iterFirst($obBackInvoice->getItemsList()->filter('entity_id = ?', $this->_obItem->entity_id));
     $obOldInvoice = $this->_obItem->getInvoice();
     $backItem->descr .= 'Возврат из накладной №' . $obOldInvoice->number;
     $backItem->save();
     return TRUE;
 }
开发者ID:evilgeny,项目名称:bob,代码行数:14,代码来源:Back.class.php

示例8: process

 public function process(array $data, $field, RM_Base_iResult $result)
 {
     $iterator = M('Purchase')->getPurchaseList()->filter('user_id=? and bdate=? and check_id=? and is_deleted=0 and shop_id!=?', $data['user_id'], $data['bdate'], $data['check_id'], $data['shop_id']);
     if ($data['id']) {
         $iterator->filter('id!=?', $data['id']);
     }
     if ($data['shop_id'] < 1 || isNull(iterFirst($iterator))) {
         return TRUE;
     }
     $result->error('shop_not_the_same', $field);
     return FALSE;
 }
开发者ID:evilgeny,项目名称:bob,代码行数:12,代码来源:Shop.class.php

示例9: process

 public function process(array $data, $field, RM_Base_iResult $result)
 {
     $search = M('Purchase')->getPurchaseList()->filter('user_id=? and bdate=? and receipt_id=? and is_deleted=0 and barcode_value=?', $data['user_id'], $data['bdate'], $data['receipt_id'], $data['barcode_value']);
     if ($data['id']) {
         $search->filter('id!=?', $data['id']);
     }
     if ($data['is_deleted'] == 1 || isNull(iterFirst($search))) {
         return TRUE;
     }
     $result->error('barcode_not_unique', $field);
     return FALSE;
 }
开发者ID:evilgeny,项目名称:bob,代码行数:12,代码来源:UniqueBarcode.class.php

示例10: process

 public function process(RM_Points_Action $obAction = NULL)
 {
     $params = $obAction->getParams();
     $obAccount = $this->getAccount($params['user_id']);
     $obPayment = iterFirst($obAccount->getPaymentList()->filter('event=? and amount_date=? and vocation_end=?', 'leave-add', $params['prevFrom'], $params['prevTo']));
     if (isNull($obPayment)) {
         return TRUE;
     }
     $obPayment->amount_date = $params['from'];
     $obPayment->vocation_end = $params['to'];
     return $obPayment->save();
 }
开发者ID:evilgeny,项目名称:bob,代码行数:12,代码来源:Update.class.php

示例11: countAgain

 public function countAgain()
 {
     $barcode = MC('AveragePrice')->getBarcodeValue();
     $obQuery = MC('AveragePrice')->getQuery($barcode);
     if ($this->getSigma() > $this->max) {
         $obQuery->where('p.price/p.quantity < ?', $this->getSigma(1));
     }
     if ($this->getSigma() < $this->min) {
         $obQuery->where('p.price/p.quantity > ?', $this->getSigma(-1));
     }
     $obQuery->where('b.product_qty = ? AND b.product_measure = ? ', $this->qty, $this->measure);
     return iterFirst($obQuery->execute());
 }
开发者ID:evilgeny,项目名称:bob,代码行数:13,代码来源:Item.class.php

示例12: resolveEntityNamesByIds

 public function resolveEntityNamesByIds($diff = array())
 {
     foreach ($diff as $entity => $value) {
         $diff = $this->_resolveBarcodeEntities($diff, $entity, $value);
         $diff = $this->_resolveGpcEntities($diff, $entity, $value);
         $diff = $this->_resolveGpcAttributes($diff, $entity, $value);
         if ($entity == 'cover_code' && !empty($value)) {
             $obCover = iterFirst(M('Store')->requestQuery(M('Store')->factoryObject(), M('Db')->createQuery(M('Barcode')->table('covers'))->what('CoverName name ')->where('CID = ? ', $value)));
             $diff[$entity] = !isNull($obCover) ? $obCover->name : $value;
         }
     }
     return $diff;
 }
开发者ID:evilgeny,项目名称:bob,代码行数:13,代码来源:Control.class.php

示例13: _ignoreIncrease

 protected function _ignoreIncrease(RM_Points_Account $obAccount, array $params)
 {
     if (isNull($obUser = M('User')->loadUserById($obAccount->user_id))) {
         return TRUE;
     }
     if (isNull($obPerson = iterFirst($obUser->getMainPerson()))) {
         return TRUE;
     }
     if ($obPerson->sex != 1) {
         return TRUE;
     }
     return FALSE;
 }
开发者ID:evilgeny,项目名称:bob,代码行数:13,代码来源:Feb23.class.php

示例14: checkDbRec

function checkDbRec($id, $table, $qw2Props, $props = array())
{
    $rec = iterFirst(M('Db')->query("SELECT * FROM {$table} WHERE id=?", $id));
    T()->ok($id, "#{$id} is valid");
    T()->ok(!isNull($rec), "record#{$id} exists in {$table}");
    $expected = array();
    //
    // here we do some trick: '!' in expected props means "any non-empty value"
    //
    foreach (array_merge($qw2Props, $props) as $p => $val) {
        $expected[$p] = ($val == '!' and $rec[$p]) ? $rec[$p] : $val;
    }
    T()->is_hash_eq($rec, $expected, "record#{$id} validness");
}
开发者ID:evilgeny,项目名称:bob,代码行数:14,代码来源:base.php

示例15: save

 public function save()
 {
     $barcode = $this->_object->getBarcode(TRUE);
     if ($this->_isAddToModeration()) {
         if (isNull($queue = iterFirst(M('Barcode')->getQueueList()->filter('purchase_id=?', $this->_object->id())))) {
             $queue = M('Barcode')->createQueue(array('user_id' => me()->id(), 'purchase_id' => $this->_object->id(), 'barcode_value' => $this->_object->barcode_value, 'name_old' => isNull($barcode) ? NULL : $barcode->attribute_1, 'refreshed' => isNull($barcode) ? 0 : $barcode->to_refresh));
         }
         if (!$queue->moderated) {
             $queue->name_new = $this->_object->corrected_name;
             $queue->save();
             M('Points')->registerNewBarcode($this->_object);
         }
     }
     //me()->refreshDay($this->_object->bdate, count(M('Purchase')->getPurchaseListForDiary(me(), $this->_object->bdate)->filter('status_id=3')));
     me()->refreshDayByQuery($this->_object->bdate);
 }
开发者ID:evilgeny,项目名称:bob,代码行数:16,代码来源:Ok.class.php


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