Event.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EventRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\Types\UuidType;
  9. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  10. use Symfony\Component\Uid\Uuid;
  11. #[ORM\Entity(repositoryClass: EventRepository::class)]
  12. class Event
  13. {
  14. #[ORM\Id]
  15. #[ORM\Column(type: UuidType::NAME, unique: true)]
  16. #[ORM\GeneratedValue(strategy: 'CUSTOM')]
  17. #[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
  18. private ?Uuid $id = null;
  19. #[ORM\Column(length: 255)]
  20. private ?string $name = null;
  21. #[ORM\Column(type: Types::TEXT, nullable: true)]
  22. private ?string $description = null;
  23. #[ORM\Column(length: 255, nullable: true)]
  24. private ?string $picture = null;
  25. #[ORM\Column(type: Types::DATETIME_MUTABLE)]
  26. private ?\DateTimeInterface $startOn = null;
  27. #[ORM\Column(type: Types::DATETIME_MUTABLE)]
  28. private ?\DateTimeInterface $endOn = null;
  29. #[ORM\Column(type: Types::ASCII_STRING, nullable: true)]
  30. private $moreLink;
  31. #[ORM\Column(type: Types::ASCII_STRING, nullable: true)]
  32. private $slug;
  33. #[ORM\Column(nullable: true)]
  34. private ?bool $published = null;
  35. #[ORM\Column(nullable: true)]
  36. private ?bool $private = null;
  37. #[ORM\Column(nullable: true)]
  38. private ?bool $hiddenPlanning = null;
  39. #[ORM\Column(nullable: true)]
  40. private ?bool $everyoneCanAskForGame = null;
  41. /**
  42. * @var Collection<int, Space>
  43. */
  44. #[ORM\OneToMany(targetEntity: Space::class, mappedBy: 'event', orphanRemoval: true)]
  45. private Collection $spaces;
  46. /**
  47. * @var Collection<int, Period>
  48. */
  49. #[ORM\OneToMany(targetEntity: Period::class, mappedBy: 'event', orphanRemoval: true)]
  50. private Collection $periods;
  51. /**
  52. * @var Collection<int, Slot>
  53. */
  54. #[ORM\OneToMany(targetEntity: Slot::class, mappedBy: 'event', orphanRemoval: true)]
  55. private Collection $slots;
  56. /**
  57. * @var Collection<int, Gamemaster>
  58. */
  59. #[ORM\ManyToMany(targetEntity: Gamemaster::class, inversedBy: 'eventsAssignedTo')]
  60. private Collection $gamemastersAssigned;
  61. /**
  62. * @var Collection<int, Game>
  63. */
  64. #[ORM\ManyToMany(targetEntity: Game::class, inversedBy: 'eventsAssignedTo')]
  65. private Collection $gameAssigned;
  66. public function __construct()
  67. {
  68. $this->spaces = new ArrayCollection();
  69. $this->periods = new ArrayCollection();
  70. $this->slots = new ArrayCollection();
  71. $this->gamemastersAssigned = new ArrayCollection();
  72. $this->gameAssigned = new ArrayCollection();
  73. }
  74. public function getId(): ?Uuid
  75. {
  76. return $this->id;
  77. }
  78. public function getName(): ?string
  79. {
  80. return $this->name;
  81. }
  82. public function setName(string $name): static
  83. {
  84. $this->name = $name;
  85. return $this;
  86. }
  87. public function getDescription(): ?string
  88. {
  89. return $this->description;
  90. }
  91. public function setDescription(?string $description): static
  92. {
  93. $this->description = $description;
  94. return $this;
  95. }
  96. public function getPicture(): ?string
  97. {
  98. return $this->picture;
  99. }
  100. public function setPicture(?string $picture): static
  101. {
  102. $this->picture = $picture;
  103. return $this;
  104. }
  105. public function getStartOn(): ?\DateTimeInterface
  106. {
  107. return $this->startOn;
  108. }
  109. public function setStartOn(\DateTimeInterface $startOn): static
  110. {
  111. $this->startOn = $startOn;
  112. return $this;
  113. }
  114. public function getEndOn(): ?\DateTimeInterface
  115. {
  116. return $this->endOn;
  117. }
  118. public function setEndOn(\DateTimeInterface $endOn): static
  119. {
  120. $this->endOn = $endOn;
  121. return $this;
  122. }
  123. public function getMoreLink()
  124. {
  125. return $this->moreLink;
  126. }
  127. public function setMoreLink($moreLink): static
  128. {
  129. $this->moreLink = $moreLink;
  130. return $this;
  131. }
  132. public function getSlug()
  133. {
  134. return $this->slug;
  135. }
  136. public function setSlug($slug): static
  137. {
  138. $this->slug = $slug;
  139. return $this;
  140. }
  141. public function isPublished(): ?bool
  142. {
  143. return $this->published;
  144. }
  145. public function setPublished(?bool $published): static
  146. {
  147. $this->published = $published;
  148. return $this;
  149. }
  150. public function isPrivate(): ?bool
  151. {
  152. return $this->private;
  153. }
  154. public function setPrivate(?bool $private): static
  155. {
  156. $this->private = $private;
  157. return $this;
  158. }
  159. public function isHiddenPlanning(): ?bool
  160. {
  161. return $this->hiddenPlanning;
  162. }
  163. public function setHiddenPlanning(?bool $hiddenPlanning): static
  164. {
  165. $this->hiddenPlanning = $hiddenPlanning;
  166. return $this;
  167. }
  168. public function isEveryoneCanAskForGame(): ?bool
  169. {
  170. return $this->everyoneCanAskForGame;
  171. }
  172. public function setEveryoneCanAskForGame(?bool $everyoneCanAskForGame): static
  173. {
  174. $this->everyoneCanAskForGame = $everyoneCanAskForGame;
  175. return $this;
  176. }
  177. /**
  178. * @return Collection<int, Space>
  179. */
  180. public function getSpaces(): Collection
  181. {
  182. return $this->spaces;
  183. }
  184. public function addSpace(Space $space): static
  185. {
  186. if (!$this->spaces->contains($space)) {
  187. $this->spaces->add($space);
  188. $space->setEvent($this);
  189. }
  190. return $this;
  191. }
  192. public function removeSpace(Space $space): static
  193. {
  194. if ($this->spaces->removeElement($space)) {
  195. // set the owning side to null (unless already changed)
  196. if ($space->getEvent() === $this) {
  197. $space->setEvent(null);
  198. }
  199. }
  200. return $this;
  201. }
  202. /**
  203. * @return Collection<int, Period>
  204. */
  205. public function getPeriods(): Collection
  206. {
  207. return $this->periods;
  208. }
  209. public function addPeriod(Period $period): static
  210. {
  211. if (!$this->periods->contains($period)) {
  212. $this->periods->add($period);
  213. $period->setEvent($this);
  214. }
  215. return $this;
  216. }
  217. public function removePeriod(Period $period): static
  218. {
  219. if ($this->periods->removeElement($period)) {
  220. // set the owning side to null (unless already changed)
  221. if ($period->getEvent() === $this) {
  222. $period->setEvent(null);
  223. }
  224. }
  225. return $this;
  226. }
  227. /**
  228. * @return Collection<int, Slot>
  229. */
  230. public function getSlots(): Collection
  231. {
  232. return $this->slots;
  233. }
  234. public function addSlot(Slot $slot): static
  235. {
  236. if (!$this->slots->contains($slot)) {
  237. $this->slots->add($slot);
  238. $slot->setEvent($this);
  239. }
  240. return $this;
  241. }
  242. public function removeSlot(Slot $slot): static
  243. {
  244. if ($this->slots->removeElement($slot)) {
  245. // set the owning side to null (unless already changed)
  246. if ($slot->getEvent() === $this) {
  247. $slot->setEvent(null);
  248. }
  249. }
  250. return $this;
  251. }
  252. /**
  253. * @return Collection<int, Gamemaster>
  254. */
  255. public function getGamemastersAssigned(): Collection
  256. {
  257. return $this->gamemastersAssigned;
  258. }
  259. public function addGamemastersAssigned(Gamemaster $gamemastersAssigned): static
  260. {
  261. if (!$this->gamemastersAssigned->contains($gamemastersAssigned)) {
  262. $this->gamemastersAssigned->add($gamemastersAssigned);
  263. }
  264. return $this;
  265. }
  266. public function removeGamemastersAssigned(Gamemaster $gamemastersAssigned): static
  267. {
  268. $this->gamemastersAssigned->removeElement($gamemastersAssigned);
  269. return $this;
  270. }
  271. /**
  272. * @return Collection<int, Game>
  273. */
  274. public function getGameAssigned(): Collection
  275. {
  276. return $this->gameAssigned;
  277. }
  278. public function addGameAssigned(Game $gameAssigned): static
  279. {
  280. if (!$this->gameAssigned->contains($gameAssigned)) {
  281. $this->gameAssigned->add($gameAssigned);
  282. }
  283. return $this;
  284. }
  285. public function removeGameAssigned(Game $gameAssigned): static
  286. {
  287. $this->gameAssigned->removeElement($gameAssigned);
  288. return $this;
  289. }
  290. }