src/Entity/Game/WordSearch/WordSearchLevel.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Game\WordSearch;
  3. use App\Repository\Game\WordSearch\WordSearchLevelRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=WordSearchLevelRepository::class)
  9. */
  10. class WordSearchLevel
  11. {
  12. /**
  13. * @ORM\Id
  14. * @ORM\GeneratedValue
  15. * @ORM\Column(type="integer")
  16. */
  17. private $id;
  18. /**
  19. * @ORM\Column(type="integer")
  20. */
  21. private $levelNumber;
  22. /**
  23. * @ORM\Column(type="string", length=255, nullable=true)
  24. */
  25. private $difficulty;
  26. /**
  27. * @ORM\ManyToOne(targetEntity=WordSearchGame::class, inversedBy="levels")
  28. * @ORM\JoinColumn(nullable=false)
  29. */
  30. private $game;
  31. /**
  32. * @ORM\OneToOne(targetEntity=Grid::class, cascade={"persist", "remove"})
  33. */
  34. private $grid;
  35. /**
  36. * @ORM\OneToMany(targetEntity=WordSearchParticipation::class, mappedBy="level")
  37. */
  38. private $participations;
  39. /**
  40. * @ORM\Column(type="integer", nullable=true)
  41. */
  42. private $requiredScore;
  43. /**
  44. * @ORM\Column(type="boolean")
  45. */
  46. private $isPublished = true;
  47. /**
  48. * @ORM\Column(type="string", length=191, nullable=true)
  49. */
  50. private $slug;
  51. public function __construct()
  52. {
  53. $this->participations = new ArrayCollection();
  54. }
  55. public function getId(): ?int
  56. {
  57. return $this->id;
  58. }
  59. public function getLevelNumber(): ?int
  60. {
  61. return $this->levelNumber;
  62. }
  63. public function setLevelNumber(int $levelNumber): self
  64. {
  65. $this->levelNumber = $levelNumber;
  66. return $this;
  67. }
  68. public function getDifficulty(): ?string
  69. {
  70. return $this->difficulty;
  71. }
  72. public function setDifficulty(?string $difficulty): self
  73. {
  74. $this->difficulty = $difficulty;
  75. return $this;
  76. }
  77. public function getGame(): ?WordSearchGame
  78. {
  79. return $this->game;
  80. }
  81. public function setGame(?WordSearchGame $game): self
  82. {
  83. $this->game = $game;
  84. return $this;
  85. }
  86. public function getGrid(): ?Grid
  87. {
  88. return $this->grid;
  89. }
  90. public function setGrid(?Grid $grid): self
  91. {
  92. $this->grid = $grid;
  93. return $this;
  94. }
  95. /**
  96. * @return Collection<int, WordSearchParticipation>
  97. */
  98. public function getParticipations(): Collection
  99. {
  100. return $this->participations;
  101. }
  102. public function addParticipation(WordSearchParticipation $participation): self
  103. {
  104. if (!$this->participations->contains($participation)) {
  105. $this->participations[] = $participation;
  106. $participation->setLevel($this);
  107. }
  108. return $this;
  109. }
  110. public function removeParticipation(WordSearchParticipation $participation): self
  111. {
  112. if ($this->participations->removeElement($participation)) {
  113. // set the owning side to null (unless already changed)
  114. if ($participation->getLevel() === $this) {
  115. $participation->setLevel(null);
  116. }
  117. }
  118. return $this;
  119. }
  120. public function getRequiredScore(): ?int
  121. {
  122. return $this->requiredScore;
  123. }
  124. public function setRequiredScore(?int $requiredScore): self
  125. {
  126. $this->requiredScore = $requiredScore;
  127. return $this;
  128. }
  129. public function isIsPublished(): ?bool
  130. {
  131. return $this->isPublished;
  132. }
  133. public function setIsPublished(bool $isPublished): self
  134. {
  135. $this->isPublished = $isPublished;
  136. return $this;
  137. }
  138. public function getSlug(): ?string
  139. {
  140. return $this->slug;
  141. }
  142. public function setSlug(?string $slug): self
  143. {
  144. $this->slug = $slug;
  145. return $this;
  146. }
  147. }