public function moveShow($deltaDay, $deltaMin) { try { $con = Propel::getConnection(); $con->beginTransaction(); //new starts,ends are in UTC list($newStartsDateTime, $newEndsDateTime) = $this->validateShowMove($deltaDay, $deltaMin); $oldStartDateTime = $this->ccShowInstance->getDbStarts(null); $this->ccShowInstance->setDbStarts($newStartsDateTime)->setDbEnds($newEndsDateTime)->save($con); if (!$this->ccShowInstance->getCcShow()->isRebroadcast()) { //we can get the first show day because we know the show is //not repeating, and therefore will only have one show day entry $ccShowDay = $this->ccShow->getFirstCcShowDay(); $showTimezone = new DateTimeZone($ccShowDay->getDbTimezone()); $ccShowDay->setDbFirstShow($newStartsDateTime->setTimezone($showTimezone)->format("Y-m-d"))->setDbStartTime($newStartsDateTime->format("H:i"))->save($con); } $diff = $newStartsDateTime->getTimestamp() - $oldStartDateTime->getTimestamp(); Application_Service_SchedulerService::updateScheduleStartTime(array($this->ccShowInstance->getDbId()), $diff); $con->commit(); Application_Model_RabbitMq::PushSchedule(); } catch (Exception $e) { $con->rollback(); return $e->getMessage(); } }
private function updateScheduleStartEndTimes($showData) { $showId = $this->ccShow->getDbId(); //DateTime in show's local time $newStartDateTime = new DateTime($showData["add_show_start_date"] . " " . $showData["add_show_start_time"], new DateTimeZone($showData["add_show_timezone"])); $diff = $this->calculateShowStartDiff($newStartDateTime, $this->origCcShowDay->getLocalStartDateAndTime()); $ccShowInstances = $this->ccShow->getFutureCcShowInstancess(); $instanceIds = array(); foreach ($ccShowInstances as $ccShowInstance) { array_push($instanceIds, $ccShowInstance->getDbId()); } Application_Service_SchedulerService::updateScheduleStartTime($instanceIds, $diff); }