예제 #1
0
 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);
 }
예제 #2
0
 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);
 }
예제 #3
0
파일: User.php 프로젝트: wisembly/calendart
 /**
  * {@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();
 }