• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP iterFirst函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: iterFirst

            $action = "already exists";
        }
        echo $obValue->id() . ' ' . $obValue->getName() . " {$action}\n";
        if (isNull(iterFirst($obAttribute->getValues($obBrick)->filter('id = ?', $obValue->id())))) {
            $obAttribute->addValue($obValue, $obBrick);
            echo $obValue->id() . ' ' . $obValue->getName() . " added into attribute for specified brick\n";
        } else {
            echo $obValue->id() . ' ' . $obValue->getName() . " already into attribute\n";
        }
    }
}
$obProvansValue = iterFirst($obAttribute->getValues($obBrick)->filter('rus_name = ?', 'Прованс'));
$many_words = array('Великий пост' => array('великий пост'), 'Деликатесный столовый' => array('деликатесный столовый'), 'Золотой провансаль' => array('золотой провансаль'), 'Золотой провансаль-м' => array('золотой провансаль-м'), 'Летнее настроение' => array('летнее настроение'), 'Мой майонез' => array('мой майонез'), 'На всякий случай' => array('на всякий случай'), 'Премиум-М' => array('премиум-м'), 'Премиум домашний' => array('премиум домашний'), 'Премиум знатный' => array('премиум знатный'), 'Премиум золотой' => array('премиум золотой'), 'Провансаль-М премиум/Провансаль-М premium' => array('провансаль-м премиум', 'провансаль-м premium'), 'Провансаль премиум/Провансаль premium' => array('провансаль премиум', 'провансаль premium'), 'Просто любимый' => array('просто любимый'));
$many_words_values = array();
foreach ($many_words as $v_name => $needles) {
    $obValue = iterFirst($obAttribute->getValues($obBrick)->filter('rus_name = ?', $v_name));
    $many_words_values[$obValue->id()] = $needles;
}
$values = array();
foreach ($obAttribute->getValues($obBrick) as $obValue) {
    $values[$obValue->id()] = mb_strtolower($obValue->getName(), 'utf-8');
}
function findNeedle($description, $subbrand_name, $value_id, $value_name)
{
    global $obProvansValue;
    $result = 0;
    if ($subbrand_name && strstr($subbrand_name, $value_name)) {
        $result = $value_id;
    } else {
        if ($description && strstr($description, ' ' . $value_name)) {
            $result = $value_id;
开发者ID:evilgeny,项目名称:bob,代码行数:31,代码来源:dressing_new.php


示例17: getInvoiceBetweenHolders

 /**
  * Returns invoice with state "crerate" between two holders
  *
  * @param RM_Holder_Object $obSourceHolder
  * @param RM_Holder_Object $obDestinationHolder
  * @return RM_Holder_Invoice
  */
 public function getInvoiceBetweenHolders(RM_Holder_Object $obSourceHolder, RM_Holder_Object $obDestinationHolder)
 {
     return iterFirst($this->getList('invoice')->filter('from_holder_id = ? AND to_holder_id = ? AND state = ? AND is_deleted = 0', $obSourceHolder->id(), $obDestinationHolder->id(), RM_Holder_Invoice_State::OPEN)->sort('cdate', 'DESC'));
 }
开发者ID:evilgeny,项目名称:bob,代码行数:11,代码来源:Mapper.class.php


示例18: Exception

<?php

/**
 *	Edit price distribution
 */
if ($list->id() != 7) {
    throw Exception(__FILE__ . 'Wrong report = ' . $list->id() . ' to edit!');
}
try {
    MC('Report_PriceDistribution')->editData($_POST);
} catch (RM_Validator_Exception $e) {
    $err = iterFirst($e->getResult()->getErrors());
    error(L('purchase.' . $err['code']));
}
开发者ID:evilgeny,项目名称:bob,代码行数:14,代码来源:edit.php


示例19: loadLinkByShopId

 /**
  *	Description...
  *
  *	@return void
  **/
 public function loadLinkByShopId($shopId, RM_User_Object $user = NULL)
 {
     if (isNull($user)) {
         $user = M('Account')->getLoggedUser();
     }
     if (isNull($user)) {
         throw new Exception('No loggedUser!');
     }
     return iterFirst($this->_mapper->_storage('link')->getObjectList()->filter('shop_id=? and user_id=?', $shopId, $user->id()));
 }
开发者ID:evilgeny,项目名称:bob,代码行数:15,代码来源:Facade.class.php


示例20: loadBarcodeByValue

 /**
  *	Returns Barcode by value
  *
  * 	@param 	string		barcode
  *	@return RM_Barcode_Object
  **/
 public function loadBarcodeByValue($barcode)
 {
     return iterFirst($this->_mapper->storage('barcode')->getObjectList()->filter('value=?', $barcode));
 }
开发者ID:evilgeny,项目名称:bob,代码行数:10,代码来源:Facade.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP iterator_apply函数代码示例发布时间:2022-05-15
下一篇:
PHP itemurl函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap