Exemplo n.º 1
0
 public static function getSingleRow($filter)
 {
     $data = parent::find(self::getOptions($filter));
     if (empty($data)) {
         return false;
     }
     return $data->to_array();
 }
Exemplo n.º 2
0
 /**
  * Fetches a user's info by either its username or its email and its password 
  * @param string $username_or_email The users ID or username 
  * @param string $password the user's email or password if password no set it only will search by username or email
  * @return user
  */
 public static function Fetch($username_or_email, $password = NULL)
 {
     # find the user with its username or email and password
     $cond = array("(username = ? OR email = ?)", $username_or_email, $username_or_email);
     if ($password) {
         $cond[0] .= " AND password = MD5(?)";
         $cond[] = $password;
     }
     return parent::find("first", array('conditions' => $cond));
 }
Exemplo n.º 3
0
 public function paginate($limit, $offset)
 {
     return parent::find('all', array('limit' => $limit, 'offset' => $offset));
 }
Exemplo n.º 4
0
 public function destroy($id)
 {
     return \ActiveRecord\Model::find($id)->delete();
 }