Event.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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. public function __construct()
  57. {
  58. $this->spaces = new ArrayCollection();
  59. $this->periods = new ArrayCollection();
  60. $this->slots = new ArrayCollection();
  61. }
  62. public function getId(): ?Uuid
  63. {
  64. return $this->id;
  65. }
  66. public function getName(): ?string
  67. {
  68. return $this->name;
  69. }
  70. public function setName(string $name): static
  71. {
  72. $this->name = $name;
  73. return $this;
  74. }
  75. public function getDescription(): ?string
  76. {
  77. return $this->description;
  78. }
  79. public function setDescription(?string $description): static
  80. {
  81. $this->description = $description;
  82. return $this;
  83. }
  84. public function getPicture(): ?string
  85. {
  86. return $this->picture;
  87. }
  88. public function setPicture(?string $picture): static
  89. {
  90. $this->picture = $picture;
  91. return $this;
  92. }
  93. public function getStartOn(): ?\DateTimeInterface
  94. {
  95. return $this->startOn;
  96. }
  97. public function setStartOn(\DateTimeInterface $startOn): static
  98. {
  99. $this->startOn = $startOn;
  100. return $this;
  101. }
  102. public function getEndOn(): ?\DateTimeInterface
  103. {
  104. return $this->endOn;
  105. }
  106. public function setEndOn(\DateTimeInterface $endOn): static
  107. {
  108. $this->endOn = $endOn;
  109. return $this;
  110. }
  111. public function getMoreLink()
  112. {
  113. return $this->moreLink;
  114. }
  115. public function setMoreLink($moreLink): static
  116. {
  117. $this->moreLink = $moreLink;
  118. return $this;
  119. }
  120. public function getSlug()
  121. {
  122. return $this->slug;
  123. }
  124. public function setSlug($slug): static
  125. {
  126. $this->slug = $slug;
  127. return $this;
  128. }
  129. public function isPublished(): ?bool
  130. {
  131. return $this->published;
  132. }
  133. public function setPublished(?bool $published): static
  134. {
  135. $this->published = $published;
  136. return $this;
  137. }
  138. public function isPrivate(): ?bool
  139. {
  140. return $this->private;
  141. }
  142. public function setPrivate(?bool $private): static
  143. {
  144. $this->private = $private;
  145. return $this;
  146. }
  147. public function isHiddenPlanning(): ?bool
  148. {
  149. return $this->hiddenPlanning;
  150. }
  151. public function setHiddenPlanning(?bool $hiddenPlanning): static
  152. {
  153. $this->hiddenPlanning = $hiddenPlanning;
  154. return $this;
  155. }
  156. public function isEveryoneCanAskForGame(): ?bool
  157. {
  158. return $this->everyoneCanAskForGame;
  159. }
  160. public function setEveryoneCanAskForGame(?bool $everyoneCanAskForGame): static
  161. {
  162. $this->everyoneCanAskForGame = $everyoneCanAskForGame;
  163. return $this;
  164. }
  165. /**
  166. * @return Collection<int, Space>
  167. */
  168. public function getSpaces(): Collection
  169. {
  170. return $this->spaces;
  171. }
  172. public function addSpace(Space $space): static
  173. {
  174. if (!$this->spaces->contains($space)) {
  175. $this->spaces->add($space);
  176. $space->setEvent($this);
  177. }
  178. return $this;
  179. }
  180. public function removeSpace(Space $space): static
  181. {
  182. if ($this->spaces->removeElement($space)) {
  183. // set the owning side to null (unless already changed)
  184. if ($space->getEvent() === $this) {
  185. $space->setEvent(null);
  186. }
  187. }
  188. return $this;
  189. }
  190. /**
  191. * @return Collection<int, Period>
  192. */
  193. public function getPeriods(): Collection
  194. {
  195. return $this->periods;
  196. }
  197. public function addPeriod(Period $period): static
  198. {
  199. if (!$this->periods->contains($period)) {
  200. $this->periods->add($period);
  201. $period->setEvent($this);
  202. }
  203. return $this;
  204. }
  205. public function removePeriod(Period $period): static
  206. {
  207. if ($this->periods->removeElement($period)) {
  208. // set the owning side to null (unless already changed)
  209. if ($period->getEvent() === $this) {
  210. $period->setEvent(null);
  211. }
  212. }
  213. return $this;
  214. }
  215. /**
  216. * @return Collection<int, Slot>
  217. */
  218. public function getSlots(): Collection
  219. {
  220. return $this->slots;
  221. }
  222. public function addSlot(Slot $slot): static
  223. {
  224. if (!$this->slots->contains($slot)) {
  225. $this->slots->add($slot);
  226. $slot->setEvent($this);
  227. }
  228. return $this;
  229. }
  230. public function removeSlot(Slot $slot): static
  231. {
  232. if ($this->slots->removeElement($slot)) {
  233. // set the owning side to null (unless already changed)
  234. if ($slot->getEvent() === $this) {
  235. $slot->setEvent(null);
  236. }
  237. }
  238. return $this;
  239. }
  240. }