本文整理汇总了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;
}