public function testSetOrganizationForPublic() { $obj = new SystemCalendar(); $obj->setPublic(true); $this->assertTrue($obj->isPublic()); $this->assertNull($obj->getOrganization()); $obj->setOrganization(new Organization()); $this->assertNull($obj->getOrganization()); }
/** * Gets UID of a calendar this event belongs to * The calendar UID is a string includes a calendar alias and id in the following format: {alias}_{id} * * @return string|null */ public function getCalendarUid() { if ($this->calendar) { return sprintf('%s_%d', Calendar::CALENDAR_ALIAS, $this->calendar->getId()); } elseif ($this->systemCalendar) { $alias = $this->systemCalendar->isPublic() ? SystemCalendar::PUBLIC_CALENDAR_ALIAS : SystemCalendar::CALENDAR_ALIAS; return sprintf('%s_%d', $alias, $this->systemCalendar->getId()); } return null; }
/** * @param SystemCalendar $entity * * @throws NotFoundHttpException */ protected function checkPermissionByConfig(SystemCalendar $entity) { if ($entity->isPublic()) { if (!$this->getCalendarConfig()->isPublicCalendarEnabled()) { throw $this->createNotFoundException('Public calendars are disabled.'); } } else { if (!$this->getCalendarConfig()->isSystemCalendarEnabled()) { throw $this->createNotFoundException('System calendars are disabled.'); } } }