|
@@ -0,0 +1,246 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Entity;
|
|
|
+
|
|
|
+use App\Repository\PartyRepository;
|
|
|
+use Doctrine\Common\Collections\ArrayCollection;
|
|
|
+use Doctrine\Common\Collections\Collection;
|
|
|
+use Doctrine\DBAL\Types\Types;
|
|
|
+use Doctrine\ORM\Mapping as ORM;
|
|
|
+
|
|
|
+#[ORM\Entity(repositoryClass: PartyRepository::class)]
|
|
|
+class Party
|
|
|
+{
|
|
|
+ #[ORM\Id]
|
|
|
+ #[ORM\GeneratedValue]
|
|
|
+ #[ORM\Column]
|
|
|
+ private ?int $id = null;
|
|
|
+
|
|
|
+ #[ORM\ManyToOne(inversedBy: 'parties')]
|
|
|
+ private ?Gamemaster $gamemaster = null;
|
|
|
+
|
|
|
+ #[ORM\ManyToOne(inversedBy: 'parties')]
|
|
|
+ private ?Game $game = null;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @var Collection<int, Slot>
|
|
|
+ */
|
|
|
+ #[ORM\OneToMany(targetEntity: Slot::class, mappedBy: 'party')]
|
|
|
+ #[ORM\OrderBy(["startOn" => "ASC"])]
|
|
|
+ private Collection $slots;
|
|
|
+
|
|
|
+ #[ORM\ManyToOne(inversedBy: 'parties')]
|
|
|
+ #[ORM\JoinColumn(nullable: false)]
|
|
|
+ private ?Event $event = null;
|
|
|
+
|
|
|
+ #[ORM\Column(nullable: true)]
|
|
|
+ private ?\DateTime $startOn = null;
|
|
|
+
|
|
|
+ #[ORM\Column(nullable: true)]
|
|
|
+ private ?\DateTime $endOn = null;
|
|
|
+
|
|
|
+ #[ORM\Column(nullable: true)]
|
|
|
+ private ?bool $gamemasterIsAuthor = null;
|
|
|
+
|
|
|
+ #[ORM\Column(nullable: true)]
|
|
|
+ private ?int $minParticipants = null;
|
|
|
+
|
|
|
+ #[ORM\Column(nullable: true)]
|
|
|
+ private ?int $maxParticipants = null;
|
|
|
+
|
|
|
+ #[ORM\Column(type: Types::TEXT, nullable: true)]
|
|
|
+ private ?string $description = null;
|
|
|
+
|
|
|
+ #[ORM\ManyToOne(inversedBy: 'submittedParties')]
|
|
|
+ private ?User $submitter = null;
|
|
|
+
|
|
|
+ #[ORM\Column(nullable: true)]
|
|
|
+ private ?\DateTime $submittedDate = null;
|
|
|
+
|
|
|
+ #[ORM\Column(nullable: true)]
|
|
|
+ private ?bool $validated = null;
|
|
|
+
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
+ $this->slots = new ArrayCollection();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getId(): ?int
|
|
|
+ {
|
|
|
+ return $this->id;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getGamemaster(): ?Gamemaster
|
|
|
+ {
|
|
|
+ return $this->gamemaster;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setGamemaster(?Gamemaster $gamemaster): static
|
|
|
+ {
|
|
|
+ $this->gamemaster = $gamemaster;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getGame(): ?Game
|
|
|
+ {
|
|
|
+ return $this->game;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setGame(?Game $game): static
|
|
|
+ {
|
|
|
+ $this->game = $game;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @return Collection<int, Slot>
|
|
|
+ */
|
|
|
+ public function getSlots(): Collection
|
|
|
+ {
|
|
|
+ return $this->slots;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function addSlot(Slot $slot): static
|
|
|
+ {
|
|
|
+ if (!$this->slots->contains($slot)) {
|
|
|
+ $this->slots->add($slot);
|
|
|
+ $slot->setParty($this);
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function removeSlot(Slot $slot): static
|
|
|
+ {
|
|
|
+ if ($this->slots->removeElement($slot)) {
|
|
|
+ // set the owning side to null (unless already changed)
|
|
|
+ if ($slot->getParty() === $this) {
|
|
|
+ $slot->setParty(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getEvent(): ?Event
|
|
|
+ {
|
|
|
+ return $this->event;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setEvent(?Event $event): static
|
|
|
+ {
|
|
|
+ $this->event = $event;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getStartOn(): ?\DateTime
|
|
|
+ {
|
|
|
+ return $this->startOn;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setStartOn(?\DateTime $startOn): static
|
|
|
+ {
|
|
|
+ $this->startOn = $startOn;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getEndOn(): ?\DateTime
|
|
|
+ {
|
|
|
+ return $this->endOn;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setEndOn(?\DateTime $endOn): static
|
|
|
+ {
|
|
|
+ $this->endOn = $endOn;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function isGamemasterIsAuthor(): ?bool
|
|
|
+ {
|
|
|
+ return $this->gamemasterIsAuthor;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setGamemasterIsAuthor(?bool $gamemasterIsAuthor): static
|
|
|
+ {
|
|
|
+ $this->gamemasterIsAuthor = $gamemasterIsAuthor;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getMinParticipants(): ?int
|
|
|
+ {
|
|
|
+ return $this->minParticipants;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setMinParticipants(?int $minParticipants): static
|
|
|
+ {
|
|
|
+ $this->minParticipants = $minParticipants;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getMaxParticipants(): ?int
|
|
|
+ {
|
|
|
+ return $this->maxParticipants;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setMaxParticipants(?int $maxParticipants): static
|
|
|
+ {
|
|
|
+ $this->maxParticipants = $maxParticipants;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getDescription(): ?string
|
|
|
+ {
|
|
|
+ return $this->description;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setDescription(?string $description): static
|
|
|
+ {
|
|
|
+ $this->description = $description;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getSubmitter(): ?User
|
|
|
+ {
|
|
|
+ return $this->submitter;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setSubmitter(?User $submitter): static
|
|
|
+ {
|
|
|
+ $this->submitter = $submitter;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getSubmittedDate(): ?\DateTime
|
|
|
+ {
|
|
|
+ return $this->submittedDate;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setSubmittedDate(?\DateTime $submittedDate): static
|
|
|
+ {
|
|
|
+ $this->submittedDate = $submittedDate;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function isValidated(): ?bool
|
|
|
+ {
|
|
|
+ return $this->validated;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setValidated(?bool $validated): static
|
|
|
+ {
|
|
|
+ $this->validated = $validated;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+}
|