當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Cabinet::query方法代碼示例

本文整理匯總了PHP中Cabinet::query方法的典型用法代碼示例。如果您正苦於以下問題:PHP Cabinet::query方法的具體用法?PHP Cabinet::query怎麽用?PHP Cabinet::query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cabinet的用法示例。


在下文中一共展示了Cabinet::query方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: AdjustPOItem

 public function AdjustPOItem($data = array())
 {
     if ($data && is_array($data)) {
         foreach ($data['quantity_list'] as $key => $val) {
             //debug(strripos($key, 'cabinet'));
             if (strripos($key, 'cabinet')) {
                 $id = explode('|', $key);
                 //debug($id);
                 App::uses("Cabinet", "Inventory.Model");
                 $list_Item = new Cabinet();
                 $query = "SELECT i.id as id, i.number as number, i.item_title as title, i.price as price, ci.item_quantity as quantity FROM  cabinets_items as ci INNER JOIN items as i ON i.id=ci.item_id WHERE ci.cabinet_id={$id['0']}";
                 $list_data = $list_Item->query($query);
                 //debug($list_data);
                 foreach ($list_data as $row) {
                     $tmp_key = $row['i']['id'] . '|item';
                     if (array_key_exists($tmp_key, $data['quantity_list'])) {
                         $data['quantity_list'][$tmp_key] = $data['quantity_list'][$tmp_key] + $row['ci']['quantity'] * $val;
                     } else {
                         $data['quantity_list'] = array_merge($data['quantity_list'], array($tmp_key => $row['ci']['quantity'] * $val));
                         $data['name_list'] = array_merge($data['name_list'], array($tmp_key => $row['ci']['number']));
                         $data['price_list'] = array_merge($data['price_list'], array($tmp_key => $row['ci']['price']));
                         $data['title_list'] = array_merge($data['title_list'], array($tmp_key => $row['ci']['title']));
                     }
                     unset($data['quantity_list'][$key]);
                     unset($data['name_list'][$key]);
                     unset($data['price_list'][$key]);
                     unset($data['title_list'][$key]);
                 }
             }
         }
     }
     return $data;
 }
開發者ID:khaled-saiful-islam,項目名稱:zen_v1.0,代碼行數:33,代碼來源:QuoteItemComponent.php


注:本文中的Cabinet::query方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。