Exemplo n.º 1
0
 public function __construct(Calendar $calendar, $status = self::STATUS_TENTATIVE)
 {
     $this->status = $status;
     $this->calendar = $calendar;
     $this->participations = new ArrayCollection();
     $calendar->getEvents()->add($this);
 }
Exemplo n.º 2
0
 /** {@inheritDoc} */
 public function get($identifier, AbstractCriterion $criterion = null)
 {
     $query = new Collection($this->fields, 'fields');
     if (null !== $criterion) {
         $query = $query->merge($criterion);
     }
     $response = $this->guzzle->get(sprintf('calendars/%s/events/%s', $this->calendar->getId(), $identifier), ['query' => $query->build()]);
     if (200 > $response->getStatusCode() || 300 <= $response->getStatusCode()) {
         throw new ApiErrorException($response);
     }
     return BasicEvent::hydrate($this->calendar, $response->json());
 }
Exemplo n.º 3
0
 /** {@inheritDoc} */
 public function get($identifier, AbstractCriterion $criterion = null)
 {
     $query = new Collection([new Collection([new Field(null, $this->criteria)], 'fields')]);
     if (null !== $criterion) {
         $query = $query->merge($criterion);
     }
     $response = $this->guzzle->get(sprintf('calendars/%s', $identifier), ['query' => $query->build()]);
     if (200 > $response->getStatusCode() || 300 <= $response->getStatusCode()) {
         throw new ApiErrorException($response);
     }
     return Calendar::hydrate($response->json(), $this->adapter->getUser());
 }