/** * Сохраняет расписание передач в заданном интервале в БД * @param \DateTime $fromTime * @param \DateTime $toTime */ public function saveSchedules(\DateTime $fromTime, \DateTime $toTime) { try { $programs = $this->scheduleSoapClient->getInfoByTime($fromTime->format('Y-m-d H:i:s'), $toTime->format('Y-m-d H:i:s')); $programsArray = json_decode($programs, true); } catch (\Exception $e) { // TODO: Залогировать ошибку return; } foreach ($programsArray as $startTime => $program) { $this->db->insertArray('programs', ['time' => $startTime, 'program' => $program]); } }
/** * @param $filePath * @param \DateTime $videoStartTime * @param \DateTime $videoEndTime */ private function saveVideoInfo($filePath, \DateTime $videoStartTime, \DateTime $videoEndTime) { $this->db->insertArray('video', ['start_time' => $videoStartTime->format('Y-m-d H:i:s'), 'end_time' => $videoEndTime->format('Y-m-d H:i:s'), 'url' => str_replace($this->storagePath, '', $filePath)]); }