예제 #1
0
 /**
  * finds a user from Database based on ID and returns a User object located
  * in memory.
  *
  * @param int $id
  *
  * @throws \InvalidArgumentException
  *
  * @return User
  */
 public function findById($id)
 {
     $result = $this->adapter->find($id);
     if (0 == count($result)) {
         throw new \InvalidArgumentException("User #{$id} not found");
     }
     $row = $result->current();
     return $this->mapObject($row);
 }
예제 #2
0
 public function find($conditions = null, $fields = '*')
 {
     if (empty($conditions)) {
         return parent::find($this->dbtable, $fields);
     } else {
         return parent::findBy($this->dbtable, $fields, $conditions);
     }
 }