Skip to content

Instantly share code, notes, and snippets.

@BlackScorp
Created October 15, 2013 11:51
Show Gist options
  • Save BlackScorp/6990390 to your computer and use it in GitHub Desktop.
Save BlackScorp/6990390 to your computer and use it in GitHub Desktop.
class KohanaORMUserRepository implements UserRepositoryInterface{
private $orm;
public function __construct(){
$this->orm = ORM::Factory('user');
}
public function findOneByEmail($email){
$ormUser = $this->orm->where('email','=',$email)->find();
if($ormUser){
$user = new User($ormUser->id,$ormUser->username,$ormUser->passwordHash,$ormUser->email);
return $user;
}else{
throw new Exception("User not found");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment