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'); }
public function run() { $pet = DAO::on('Pet')->findById(1); Session::set('pet', $pet); header('Location: ' . URL . 'pet/index'); }