Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }