Esempio n. 1
0
 /**
  *  get the first found row in $table according to $where_criteria
  *  
  *  @param  MingoTable  $table    
  *  @param  MingoCriteria $where_criteria
  *  @return array
  */
 public function getOne(MingoTable $table, MingoCriteria $where_criteria = null)
 {
     // set up to only select 1...
     if ($where_criteria === null) {
         $where_criteria = new MingoCriteria();
     }
     //if
     $where_criteria->setLimit(1);
     $where_criteria->setPage(0);
     $where_criteria->setOffset(0);
     $ret_list = $this->get($table, $where_criteria);
     $ret_map = reset($ret_list);
     if ($ret_map === false) {
         $ret_map = array();
     }
     //if
     return $ret_map;
 }