Example #1
0
 /**
  * @param string $type
  * @param string $table
  * @param array $settings
  * - fields: array
  * - conditions: array
  * - joins: array[ [tableName, settings: array[conditions]] ]
  * - group: string
  * - having: array[conditions]
  * - order: array[field: direction]
  * - limit: string
  * - table_arrays: bool
  * - as_key: string | array[table, field]
  * @return array|bool
  */
 public function find($type, $table, $settings = array())
 {
     if ($type == 'first') {
         $settings['limit'] = 1;
     }
     $q = QueryBuilder::buildSearchQuery($table, $settings);
     $res = $this->execute($q);
     if (!empty($res)) {
         switch ($type) {
             case 'first':
                 return $this->fetchSearchFirst($res, $settings);
             case 'all':
                 return $this->fetchSearchAll($res, $settings);
             case 'list':
                 return $this->fetchSearchList($res, $settings);
         }
     }
     #if nothing were returned
     return false;
 }