setCalendar($calendar); $this->storedObject = $storedObject; $this->datetimeVersion = $calendar->getDateTimeVersion(); } public function createFromDTO(CalendarDocCreateDTO $calendarDocCreateDTO): void { $this->storedObject = $calendarDocCreateDTO->doc; $this->storedObject->setTitle($calendarDocCreateDTO->title); } public function editFromDTO(CalendarDocEditDTO $calendarDocEditDTO): void { if (null !== $calendarDocEditDTO->doc) { $calendarDocEditDTO->doc->setTitle($this->getStoredObject()->getTitle()); $this->setStoredObject($calendarDocEditDTO->doc); } $this->getStoredObject()->setTitle($calendarDocEditDTO->title); } public function getCalendar(): Calendar { return $this->calendar; } public function getDatetimeVersion(): int { return $this->datetimeVersion; } public function getId(): ?int { return $this->id; } public function getStoredObject(): StoredObject { return $this->storedObject; } public function isTrackDateTimeVersion(): bool { return $this->trackDateTimeVersion; } /** * @internal use @see{Calendar::removeDocument} instead * * @param Calendar $calendar */ public function setCalendar(?Calendar $calendar): CalendarDoc { if (null === $calendar) { $this->calendar->removeDocument($this); } else { $calendar->addDocument($this); } $this->calendar = $calendar; $this->datetimeVersion = $calendar->getDateTimeVersion(); return $this; } public function setDatetimeVersion(int $datetimeVersion): CalendarDoc { $this->datetimeVersion = $datetimeVersion; return $this; } public function setStoredObject(StoredObject $storedObject): CalendarDoc { $this->storedObject = $storedObject; return $this; } public function setTrackDateTimeVersion(bool $trackDateTimeVersion): CalendarDoc { $this->trackDateTimeVersion = $trackDateTimeVersion; return $this; } }