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