public function __construct(AbstractEvent $event, User $user, $role = self::ROLE_PARTICIPANT, $status = self::STATUS_TENTATIVE) { $this->user = $user; $this->event = $event; $this->invitedAt = new Datetime(); $this->setRole($role); $this->setStatus($status); $user->addEvent($event); }
public function __construct(AbstractCalendar $calendar, User $owner, $name, Datetime $start, Datetime $end) { $this->name = $name; $this->owner = $owner; $this->calendar = $calendar; $this->participations = new ArrayCollection(); if ($start > $end) { throw new InvalidArgumentException('An event cannot start after it was ended'); } $this->end = $end; $this->start = $start; $owner->addEvent($this); $calendar->getEvents()->add($this); }
/** * {@inheritDoc} * * This adds also the handling of multiple emails, as a google account may * have more than one email * * @param boolean $all Fetch _all_ the emails ? * @return array|string */ public function getEmail($all = false) { if (!$all && is_array($this->email)) { return reset($this->email) ?: null; } return parent::getEmail(); }