/** * Updates an object * * @param \OCA\Calendar\IObject $object * @throws \OCA\Calendar\BusinessLayer\Exception * @return \OCA\Calendar\IObject */ public function update(IObject $object) { try { if (strval($object->getCalendar()) !== strval($this->calendar)) { throw new Exception('Can\'t update object from another calendar'); } $this->checkCalendarSupports(Permissions::UPDATE); if (!$this->api instanceof BackendUtils\IObjectAPIUpdate) { throw new Exception('Backend does not support updating objects'); } $this->checkObjectIsValid($object); Util::emitHook('\\OCA\\Calendar', 'preUpdateObject', array($object)); $object = $this->api->update($object); if ($this->isCachingEnabled) { $this->updater->propagate($object->getUri()); } Util::emitHook('\\OCA\\Calendar', 'postUpdateObject', array($object)); return $object; } catch (BackendUtils\Exception $ex) { throw Exception::fromException($ex); } }