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


PHP DataManager::prepareSelectFromArguments方法代碼示例

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


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

示例1: paginate

 /**
  * Return paginated set of project objects
  *
  * @param array $arguments
  * @param itneger $page
  * @param integer $per_page
  * @return array
  */
 function paginate($arguments = null, $page = 1, $per_page = 10)
 {
     if (!is_array($arguments)) {
         $arguments = array();
     }
     // if
     $arguments['limit'] = $per_page;
     $arguments['offset'] = ($page - 1) * $per_page;
     $items = ProjectObjects::findBySQL(DataManager::prepareSelectFromArguments($arguments, TABLE_PREFIX . 'project_objects'), null, array_var($arguments, 'one'));
     $total_items = ProjectObjects::count(array_var($arguments, 'conditions'));
     return array($items, new Pager($page, $total_items, $per_page));
 }
開發者ID:NaszvadiG,項目名稱:activecollab_loc,代碼行數:20,代碼來源:ProjectObjects.class.php

示例2: find

 /**
  * Do a SELECT query over database with specified arguments
  * 
  * This function can return single instance or array of instances that match 
  * requirements provided in $arguments associative array
  * 
  * $arguments is an associative array with following fields (all optional):
  * 
  *  - one        - select first row
  *  - conditions - additional conditions
  *  - group      - group by string
  *  - having     - having string
  *  - order      - order by string
  *  - offset     - limit offset, valid only if limit is present
  *  - limit      - number of rows that need to be returned
  *
  * @param array $arguments
  * @param string $table_name
  * @param string $item_class
  * @return mixed
  * @throws DBQueryError
  */
 function find($arguments = null, $table_name = null, $item_class = null)
 {
     return DataManager::findBySQL(DataManager::prepareSelectFromArguments($arguments, $table_name), null, array_var($arguments, 'one'), $table_name, $item_class);
 }
開發者ID:NaszvadiG,項目名稱:activecollab_loc,代碼行數:26,代碼來源:DataManager.class.php


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