public function __construct($object = '', $description = '', $location = '') { $this->setId(-1); $this->setObject($object); $this->setDescription($description); $this->setLocation($location); $this->dateStart = new \DateTime(); $this->dateStart->add(new \DateInterval('P1D')); $this->dateStart->setTime($this->dateStart->format('H'), $this->dateStart->format('i') - $this->dateStart->format('i') % 15, $this->dateStart->format('s')); $this->dateEnd = new \DateTime(); $this->dateEnd->add(new \DateInterval('P1DT2H')); $this->dateEnd->setTime($this->dateEnd->format('H'), $this->dateEnd->format('i') - $this->dateEnd->format('i') % 15, $this->dateEnd->format('s')); $this->participants = new ArrayCollection(); $this->childs = new ArrayCollection(); }
/** * Retrieve Google events on a date range * * @param string $calendarId * @param datetime $start Range start * @param datetime $end Range end * * @return object */ public function getEventsOnRange($calendarId, $start, $end) { $service = $this->getCalendarService(); $timeMin = $start->format(\DateTime::RFC3339); $timeMax = $end->add(new \DateInterval('P90D'))->format(\DateTime::RFC3339); // Params to send to Google $eventOptions = array('timeMin' => $timeMin, 'timeMax' => $timeMax); $eventList = $service->events->listEvents($calendarId, $eventOptions); return $eventList; }