本文整理匯總了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));
}
示例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);
}