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 isAnnouncementValid(AnnouncementPro $announce) { $isValid = true; $address1 = $announce->getAddress1(); $zipCide = $announce->getZipCode(); $city = $announce->getCity(); if (empty($address1) || empty($zipCide) || empty($city)) { $isValid = false; } $description = $announce->getDescription(); $photoMain = $announce->getPhotoMain(); $pricePublic = $announce->getPricePublic(); if (empty($description) || $pricePublic == 0) { $isValid = false; } return $isValid; }