/**
  * Méthode permettant d'enregistrer un profil
  * @param $profilePro Le profil à enregistrer
  * @return void
  */
 public function save(ProfilePro $profilePro)
 {
     if ($profilePro->isValid()) {
         $profilePro->isNew() ? $this->add($profilePro) : $this->modify($profilePro);
     } else {
         throw new RuntimeException('Le profil doit être valide pour être enregistré');
     }
 }
 private function parseForm(HTTPRequest $request, ProfilePro $profilePro, Address $address)
 {
     //PROFILE
     $companyName = htmlspecialchars($request->postData('company-name'));
     $lastname = htmlspecialchars($request->postData('lastname'));
     $firstname = htmlspecialchars($request->postData('firstname'));
     $description = htmlspecialchars($request->postData('description'));
     $phone = htmlspecialchars($request->postData('phone'));
     $mobilePhone = htmlspecialchars($request->postData('mobile-phone'));
     $officePhone = htmlspecialchars($request->postData('office-phone'));
     $website = htmlspecialchars($request->postData('website'));
     //ADDRESS
     $address1 = htmlspecialchars($request->postData('address-1'));
     $address2 = htmlspecialchars($request->postData('address-2'));
     $zipCode = htmlspecialchars($request->postData('zip-code'));
     $city = htmlspecialchars($request->postData('city'));
     $country = 'France';
     $profilePro->setCompanyName($companyName);
     $profilePro->setLastname($lastname);
     $profilePro->setFirstname($firstname);
     $profilePro->setDescription($description);
     $profilePro->setPhone($phone);
     $profilePro->setMobilePhone($mobilePhone);
     $profilePro->setOfficePhone($officePhone);
     $profilePro->setWebsite($website);
     $profilePro->setUserId($this->app->user()->getAttribute('id'));
     $address->setAddress1($address1);
     $address->setAddress2($address2);
     $address->setZipCode($zipCode);
     $address->setCity($city);
     $address->setCountry($country);
     $address->setTitle($companyName);
     $address->setUserId($this->app->user()->getAttribute('id'));
 }
 protected function modify(ProfilePro $profilePro)
 {
     $q = $this->dao->prepare('UPDATE ' . $this->table() . ' SET COMPANY_NAME = :companyName, LASTNAME = :lastname, FIRSTNAME = :firstname,  DESCRIPTION = :description, PHONE = :phone, MOBILE_PHONE = :mobilePhone, OFFICE_PHONE = :officePhone, WEBSITE = :website, AVATAR = :avatar, USER_ID = :userId, MAIN_ADDRESS_ID = :mainAddressId WHERE ID = :id');
     $q->bindValue(':companyName', $profilePro->getCompanyName());
     $q->bindValue(':lastname', $profilePro->getLastname());
     $q->bindValue(':firstname', $profilePro->getFirstname());
     $q->bindValue(':description', $profilePro->getDescription());
     $q->bindValue(':phone', $profilePro->getPhone());
     $q->bindValue(':mobilePhone', $profilePro->getMobilePhone());
     $q->bindValue(':officePhone', $profilePro->getOfficePhone());
     $q->bindValue(':website', $profilePro->getWebsite());
     $q->bindValue(':avatar', $profilePro->getAvatar());
     $q->bindValue(':userId', $profilePro->getUserId(), PDO::PARAM_INT);
     $q->bindValue(':mainAddressId', $profilePro->getMainAddressId(), PDO::PARAM_INT);
     $q->bindValue(':id', $profilePro->id(), PDO::PARAM_INT);
     $q->execute();
 }