public function __construct(Calendar $calendar = null) { $this->calendar = $calendar; if (null !== $calendar) { $calendar->getEvents()->add($this); } }
public function __construct(Calendar $calendar = null) { $this->calendar = $calendar; if (null !== $calendar) { $calendar->getEvents()->add($this); } $this->participations = new ArrayCollection(); }
public function get($identifier) { $request = $this->guzzle->createRequest('GET', sprintf('calendars/%s', $identifier)); $response = $this->guzzle->send($request); $this->handleResponse($response); return Calendar::hydrate($response->json()); }
public function get($identifier) { $request = $this->guzzle->createRequest('GET', sprintf('calendars/%s', $identifier)); $response = $this->guzzle->send($request); if (200 > $response->getStatusCode() || 300 <= $response->getStatusCode()) { throw new ApiErrorException($response); } return Calendar::hydrate($response->json()); }
/** * Get the occurrences, exceptions, and single instances of events in a calendar view * * If a calendar is given, it fetches the events for this calendar ; * otherwise, it takes the primary * * @param DateTime $from The date and time when the event starts. * @param DateTime $to The date and time when the event ends. * @param string $filter `$filter` query parameter to give to the request * @param string $orderBy `$orderBy` query, to have an order of elements * * @see https://msdn.microsoft.com/office/office365/APi/calendar-rest-operations#GetCalendarView */ public function getCalendarView(Calendar $calendar = null, DateTime $from, DateTime $to, $filter = '', $orderBy = '', array $extraParameters = []) { $url = 'calendarview'; if (null !== $calendar) { $url = sprintf('calendars/%s/calendarview', $calendar->getId()); } $params = ['startDateTime' => $from->format('Y-m-d\\TH:i:s\\Z'), 'endDateTime' => $to->format('Y-m-d\\TH:i:s\\Z')]; if (!empty($filter)) { $params['$filter'] = $filter; } if (!empty($orderBy)) { $params['$orderBy'] = $orderBy; } $params = ['query' => array_merge($params, $extraParameters)]; return $this->requestEvents($url, $params); }