* * @ORM\OneToMany( * targetEntity="Chill\EventBundle\Entity\Participation", * mappedBy="event") */ private Collection $participations; /** * @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\EventType") * * @Assert\NotNull() */ private ?EventType $type = null; /** * @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_") */ private CommentEmbeddable $comment; /** * @ORM\ManyToOne(targetEntity=Location::class) * * @ORM\JoinColumn(nullable=true) */ private ?Location $location = null; /** * @var Collection * * @ORM\ManyToMany(targetEntity=StoredObject::class, cascade={"persist","refresh"}) * * @ORM\JoinTable("chill_event_event_documents") */ private Collection $documents; /** * @ORM\Column(type="decimal", precision=10, scale=4, nullable=true, options={"default": null}) */ private string $organizationCost = '0.0'; /** * Event constructor. */ public function __construct() { $this->participations = new ArrayCollection(); $this->documents = new ArrayCollection(); $this->comment = new CommentEmbeddable(); } /** * Add participation. * * @return Event */ public function addParticipation(Participation $participation) { $this->participations[] = $participation; return $this; } public function addDocument(StoredObject $storedObject): self { if ($this->documents->contains($storedObject)) { $this->documents[] = $storedObject; } return $this; } public function removeDocument(StoredObject $storedObject): self { $this->documents->removeElement($storedObject); return $this; } /** * @return Center */ public function getCenter() { return $this->center; } /** * @return Scope */ public function getCircle() { return $this->circle; } /** * Get date. * * @return \DateTime */ public function getDate() { return $this->date; } /** * Get id. * * @return int */ public function getId() { return $this->id; } public function getModerator(): User|null { return $this->moderator; } /** * Get label. * * @return string */ public function getName() { return $this->name; } /** * @return Collection */ public function getParticipations(): Collection { return new ArrayCollection(iterator_to_array($this->getParticipationsOrdered())); } /** * Sort Collection of Participations. */ public function getParticipationsOrdered(): \ArrayIterator|\Traversable { $iterator = iterator_to_array($this->participations->getIterator()); uasort($iterator, static fn ($first, $second) => strnatcasecmp((string) $first->getPerson()->getFirstName(), (string) $second->getPerson()->getFirstName())); return new \ArrayIterator($iterator); } /** * @deprecated * * @return Scope */ public function getScope() { return $this->getCircle(); } /** * @return EventType */ public function getType() { return $this->type; } /** * Remove participation. */ public function removeParticipation(Participation $participation) { $this->participations->removeElement($participation); } /** * @return $this */ public function setCenter(Center $center) { $this->center = $center; return $this; } /** * @return $this */ public function setCircle(Scope $circle) { $this->circle = $circle; return $this; } /** * Set date. * * @return Event */ public function setDate(\DateTime $date) { $this->date = $date; return $this; } public function setModerator(User $moderator): self { $this->moderator = $moderator; return $this; } /** * Set label. * * @param string $label * * @return Event */ public function setName($label) { $this->name = $label; return $this; } /** * @return $this */ public function setType(EventType $type) { $this->type = $type; return $this; } public function getComment(): CommentEmbeddable { return $this->comment; } public function setComment(CommentEmbeddable $comment): void { $this->comment = $comment; } public function getLocation(): ?Location { return $this->location; } public function setLocation(?Location $location): void { $this->location = $location; } public function getDocuments(): Collection { return $this->documents; } public function setDocuments(Collection $documents): void { $this->documents = $documents; } public function getOrganizationCost(): string { return $this->organizationCost; } public function setOrganizationCost(string $organizationCost): void { $this->organizationCost = $organizationCost; } }