/** * @param integer $id * @return \OCP\AppFramework\Http\Response * * @NoAdminRequired * @NoCSRFRequired */ public function destroy($id) { try { $calendar = $this->calendars->find($id, $this->user->getUID()); $this->calendars->delete($calendar); return new JSONResponse(['message' => 'Calendar was deleted successfully']); } catch (\Exception $ex) { return $this->handleException($ex); } }
/** * get calendar entity based on it's id * @param integer $calendarId * @return \OCA\Calendar\ICalendar */ private function findCalendar($calendarId) { return $this->calendars->find($calendarId, $this->user->getUID()); }