diff --git a/src/AbstractEvent.php b/src/AbstractEvent.php index 17df339..89b8615 100644 --- a/src/AbstractEvent.php +++ b/src/AbstractEvent.php @@ -47,6 +47,9 @@ abstract class AbstractEvent /** @var Collection Participations registered to this event */ protected $participations; + /** @var Collection Attachments to this event */ + protected $attachments; + public function __construct(AbstractCalendar $calendar, User $owner, $name, Datetime $start, Datetime $end) { $this->name = $name; @@ -54,6 +57,7 @@ public function __construct(AbstractCalendar $calendar, User $owner, $name, Date $this->calendar = $calendar; $this->participations = new ArrayCollection; + $this->attachments = new ArrayCollection; if ($start > $end) { throw new InvalidArgumentException('An event cannot start after it was ended'); @@ -221,5 +225,23 @@ public function removeParticipation(EventParticipation $participation) return $this; } -} + /** @return Collection */ + public function getAttachments() + { + return $this->attachments; + } + + /** @return $this */ + public function addAttachment(Attachment $attachment) + { + $this->attachments->add($attachment); + + return $this; + } + + public function hasAttachments() + { + return $this->attachments->count() > 0; + } +} diff --git a/src/Attachment.php b/src/Attachment.php new file mode 100644 index 0000000..9f22aac --- /dev/null +++ b/src/Attachment.php @@ -0,0 +1,29 @@ +