getRecordingMeeting(); if (property_exists($object, $name)) { return $object->$name; } throw new Exception(sprintf('%s does not know property %s', $this, $name)); } /** * @return string */ public function __toString() { return sprintf('Recording %d', $this->uuid); } /** * @return Meeting */ public function getMeeting() { return $this->meeting; } /** * @throws Exception * * @return RecordingMeeting */ public function getRecordingMeeting() { return $this->recordingMeeting; } /** * @param Meeting $meeting * * @return $this */ public function setMeeting($meeting) { $this->meeting = $meeting; $this->meeting->getRecordings()->add($this); return $this; } /** * @param RecordingMeeting $recordingMeeting * * @throws Exception * * @return Recording */ public function setRecordingMeeting($recordingMeeting) { if (null === $this->uuid) { $this->uuid = $recordingMeeting->uuid; } elseif ($this->uuid !== $recordingMeeting->uuid) { throw new Exception('the RecordingEntity identifier differs from the RecordingMeeting identifier'); } if (null === $this->meeting) { $this->meeting = Database::getManager()->getRepository(Meeting::class)->find($recordingMeeting->id); } elseif ($this->meeting->getMeetingId() != $recordingMeeting->id) { // $this->meeting remains null when the remote RecordingMeeting refers to a deleted meeting. throw new Exception('The RecordingEntity meeting id differs from the RecordingMeeting meeting id'); } $this->recordingMeeting = $recordingMeeting; return $this; } /** * @ORM\PostLoad * * @throws Exception */ public function postLoad() { if (null !== $this->recordingMeetingJson) { $this->recordingMeeting = RecordingMeeting::fromJson($this->recordingMeetingJson); } $this->initializeExtraProperties(); } /** * @ORM\PreFlush */ public function preFlush() { if (null !== $this->recordingMeeting) { $this->recordingMeetingJson = json_encode($this->recordingMeeting); } } /** * @throws Exception */ public function initializeExtraProperties() { $this->startDateTime = new DateTime($this->recordingMeeting->start_time); $this->startDateTime->setTimezone(new DateTimeZone(api_get_timezone())); $this->formattedStartTime = $this->startDateTime->format('Y-m-d H:i'); $now = new DateTime(); $later = new DateTime(); $later->add(new DateInterval('PT'.$this->recordingMeeting->duration.'M')); $this->durationInterval = $later->diff($now); $this->formattedDuration = $this->durationInterval->format(get_lang('DurationFormat')); } }