當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。