public function editProfile(Lender $lender, $data) { $lender->setFirstName($data['firstName']); $lender->setLastName($data['lastName']); $lender->getUser()->setEmail($data['email']); $lender->getUser()->setUsername($data['username']); $lender->getProfile()->setAboutMe($data['aboutMe']); if (!empty($data['password'])) { $lender->getUser()->setPassword($data['password']); } $lender->save(); }
public function joinFacebookUser($facebookUser, $data) { $user = new User(); $user->setUsername($data['username'])->setEmail($facebookUser['email'])->setFacebookId($facebookUser['id']); $lender = new Lender(); $lender->setUser($user)->setFirstName($facebookUser['first_name'])->setLastName($facebookUser['last_name'])->setCountryId(1); $profile = new Profile(); $profile->setAboutMe($data['aboutMe']); $lender->setProfile($profile); $lender->save(); return $lender; }