/** * Patch a calendar from request * @param \OCA\Calendar\ICalendar $newCalendar * @param \OCA\Calendar\ICalendar $oldCalendar * @return \OCA\Calendar\ICalendar */ public function patch(ICalendar $newCalendar, ICalendar $oldCalendar) { $newCalendar->setId($oldCalendar->getId()); $newCalendar->setPrivateUri($oldCalendar->getPrivateUri()); $this->resetReadOnlyProperties($newCalendar, $oldCalendar); if ($newCalendar->doesContainNullValues()) { $newCalendar = $oldCalendar->overwriteWith($newCalendar); } /** @var \OCA\Calendar\ICalendar $newCalendar */ return parent::update($newCalendar); }
/** * {@inheritDoc} */ public function getFilePath($itemSource, $uidOwner) { try { $calendar = $this->calendars->find($itemSource, $uidOwner); $fileId = $calendar->getFileId(); if ($fileId === null) { return false; } $files = $this->userFolder->getById($fileId); if (!$files || empty($files)) { return false; } else { return $files[0]->getPath(); } } catch (BusinessLayer\Exception $ex) { return false; } }
/** * {@inheritDoc} */ public function getFilePath($itemSource, $uidOwner) { try { if (substr_count($itemSource, '::') === 0) { return false; } list($calendarId) = explode('::', $itemSource, 1); $calendar = $this->calendars->find($calendarId, $uidOwner); $fileId = $calendar->getFileId(); if ($fileId === null) { return false; } $files = $this->userFolder->getById($fileId); if (!$files || empty($files)) { return false; } else { return $files[0]->getPath(); } } catch (BusinessLayer\Exception $ex) { return false; } }