protected function modify(AnnouncementPro $announcementPro)
 {
     $q = $this->dao->prepare('UPDATE ' . $this->table() . ' SET TITLE = :title, DESCRIPTION = :description, PRICE_PUBLIC = :pricePublic, PHOTO_MAIN = :photoMain, PHOTO_OPTION_1 = :photoOption1, PHOTO_OPTION_2 = :photoOption2, TIPS = :tips, RAW_MATERIAL = :rawMaterial, ADDRESS_1 = :address1, ADDRESS_2 = :address2, ZIP_CODE = :zipCode, CITY = :city, COUNTRY = :country, REGION_ID =:regionId, DEPARTMENT_ID =:departmentId, IS_PUBLISHED = :isPublished, PUBLICATION_DATE = :publicationDate, CATEGORY_ID = :categoryId, SUB_CATEGORY_ID = :subCategoryId, USER_ID = :userId, STATE_ID = :stateId, ADMIN_COMMENT = :adminComment WHERE ID = :id');
     $q->bindValue(':title', $announcementPro->getTitle());
     $q->bindValue(':description', $announcementPro->getDescription());
     $q->bindValue(':pricePublic', $announcementPro->getPricePublic());
     $q->bindValue(':photoMain', $announcementPro->getPhotoMain());
     $q->bindValue(':photoOption1', $announcementPro->getPhotoOption1());
     $q->bindValue(':photoOption2', $announcementPro->getPhotoOption2());
     $q->bindValue(':tips', $announcementPro->getTips());
     $q->bindValue(':rawMaterial', $announcementPro->getRawMaterial());
     $q->bindValue(':address1', $announcementPro->getAddress1());
     $q->bindValue(':address2', $announcementPro->getAddress2());
     $q->bindValue(':zipCode', $announcementPro->getZipCode());
     $q->bindValue(':city', $announcementPro->getCity());
     $q->bindValue(':country', $announcementPro->getCountry());
     $q->bindValue(':regionId', $announcementPro->getRegionId());
     $q->bindValue(':departmentId', $announcementPro->getDepartmentId());
     $q->bindValue(':isPublished', $announcementPro->getIsPublished());
     $q->bindValue(':publicationDate', $announcementPro->getPublicationDate());
     $q->bindValue(':categoryId', $announcementPro->getCategoryId(), PDO::PARAM_INT);
     $q->bindValue(':subCategoryId', $announcementPro->getSubCategoryId(), PDO::PARAM_INT);
     $q->bindValue(':userId', $announcementPro->getUserId(), PDO::PARAM_INT);
     $q->bindValue(':stateId', $announcementPro->getStateId(), PDO::PARAM_INT);
     $q->bindValue(':adminComment', $announcementPro->getAdminComment());
     $q->bindValue(':id', $announcementPro->id());
     $q->execute();
 }
 private function parseForm(HTTPRequest $request, AnnouncementPro $announce)
 {
     $title = htmlspecialchars($request->postData('title'));
     $isPublished = $request->postExists('is-published');
     $description = htmlspecialchars($request->postData('description'));
     $pricePublic = htmlspecialchars($request->postData('price-public'));
     if ($request->postExists('has-tips')) {
         $tips = htmlspecialchars($request->postData('tips'));
     } else {
         $tips = '';
     }
     $rawMaterial = htmlspecialchars($request->postData('raw-material'));
     $address1 = htmlspecialchars($request->postData('address1'));
     $address2 = htmlspecialchars($request->postData('address2'));
     $zipCode = htmlspecialchars($request->postData('zip-code'));
     $city = htmlspecialchars($request->postData('city'));
     $country = 'FRANCE';
     $departmentId = htmlspecialchars($request->postData('department'));
     $regionId = $this->_departmentsManager->get($departmentId)->getRegionId();
     $categoryId = htmlspecialchars($request->postData('category'));
     $subCategoryId = htmlspecialchars($request->postData('sub-category'));
     $userId = $this->_user->id();
     //Parsing
     $announce->setTitle($title);
     $announce->setIsPublished($isPublished);
     $announce->setDescription($description);
     $announce->setPricePublic($this->str2num($pricePublic));
     $announce->setTips($tips);
     $announce->setRawMaterial($rawMaterial);
     $announce->setAddress1($address1);
     $announce->setAddress2($address2);
     $announce->setZipCode($zipCode);
     $announce->setCity($city);
     $announce->setCountry($country);
     $announce->setDepartmentId($departmentId);
     $announce->setRegionId($regionId);
     $announce->setCategoryId($categoryId);
     $announce->setSubCategoryId($subCategoryId);
     $announce->setUserId($userId);
     $announce->setAdminComment('');
     // Demande de suppression de photo
     if ($request->postExists('delete-photo-main')) {
         unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . $announce->getPhotoMain());
         unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . AnnouncementPro::THUMBNAILS_PREFIX . $announce->getPhotoMain());
         $announce->setPhotoMain('');
     }
     if ($request->postExists('delete-photo-option-1')) {
         unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . $announce->getPhotoOption1());
         unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . AnnouncementPro::THUMBNAILS_PREFIX . $announce->getPhotoOption1());
         $announce->setPhotoOption1('');
     }
     if ($request->postExists('delete-photo-option-2')) {
         unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . $announce->getPhotoOption2());
         unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . AnnouncementPro::THUMBNAILS_PREFIX . $announce->getPhotoOption2());
         $announce->setPhotoOption2('');
     }
 }