public function updateAdvertisementPosition($advertisementPositionID, $changeKey, $advertisementID, $memberID, $positionNumber, $instrumentID, $durationID, $description, $experienceID, $ageRangeID, $genderID, $dbConnection = null) { $processed = false; $update = false; try { if ($changeKey != null) { $position = new AdvertisementPosition(); $position->setVariable(AdvertisementPosition::ADVERTISEMENT_POSITION_ID, $advertisementPositionID); $position->setVariable(AdvertisementPosition::ADVERTISEMENT_ID, $advertisementID); ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_NUMBER_CHANGE_KEY, AdvertisementPosition::POSITION_NUMBER, $positionNumber, $update); ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_TYPE_CHANGE_KEY, AdvertisementPosition::INSTRUMENT_ID, $instrumentID, $update); ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_DURATION_CHANGE_KEY, AdvertisementPosition::DURATION_ID, $durationID, $update); ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_EXP_CHANGE_KEY, AdvertisementPosition::EXPERIENCE_ID, $experienceID, $update); ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_AGE_CHANGE_KEY, AdvertisementPosition::AGE_RANGE_ID, $ageRangeID, $update); ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_GENDER_CHANGE_KEY, AdvertisementPosition::GENDER_ID, $genderID, $update); ChangeUtilities::processChangeItem($position, $changeKey, AdvertisementPositionConstants::POSITION_OTHER_CHANGE_KEY, AdvertisementPosition::DESCRIPTION, $description, $update); if ($update) { $processed = AdvertisementPositionDao::updateAdvertisementPosition($memberID, $position, $dbConnection); } } } catch (Exception $ex) { $processed = false; echo 'Caught exception: ' . $ex->getMessage(); } return $processed; }
public function updateAdvertisementPosition($memberID, $positionDetails, $dbConnection) { $preparedStatement = null; $processed = false; try { if ($memberID != null & $positionDetails->getVariable(AdvertisementPosition::ADVERTISEMENT_POSITION_ID) !== null) { $positionUpdateQuery = AdvertisementPositionDao::getAdvertisementPositionUpdateQuery($positionDetails); $preparedStatement = AdvertisementPositionDao::getAdvertisementPositionPreparedStatement($positionUpdateQuery, $memberID, $positionDetails, $dbConnection); if ($preparedStatement->execute()) { } $processed = true; $preparedStatement = null; } } catch (PDOException $ex) { echo 'Caught exception: ' . $ex->getMessage() . "\n"; } return $processed; }