コード例 #1
0
ファイル: PetOwnerDAO.php プロジェクト: wbianchini/virtualpet
    public function getByEmail(string $email) : PetOwner
    {
        $data = $this->select('SELECT pet_owner_id, email, password 
			FROM pet_owner WHERE email = :email', [':email' => $email])[0];
        if (empty($data)) {
            return false;
        }
        $petOwner = new PetOwner();
        $petOwner->set_id($data['id']);
        $petOwner->set_email($data['email']);
        $petOwner->set_password($data['password']);
        return $petOwner;
    }
コード例 #2
0
ファイル: register.php プロジェクト: wbianchini/virtualpet
 public function save()
 {
     $petOwner = new PetOwner();
     $petOwner->setUsername(Session::get('username'));
     $petOwner->setEmail(Session::get('email'));
     $petOwner->setPassword(Session::get('password'));
     $petFactory = new PetFactory(Session::get('planet'), $_POST['kind']);
     $pet = $petFactory->createPet();
     // Usar transação
     DAO::on('PetOwner')->save($petOwner);
     // DAO::on('Pet')->insert($pet);
     header('Location: ' . URL . 'login/run');
 }