/**
  * 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));
 }
 /**
  * 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);
 }