src/Entity/Game/Riddle/WordRiddleLevel.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Game\Riddle;
  3. use App\Repository\Game\Riddle\WordRiddleLevelRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=WordRiddleLevelRepository::class)
  9. */
  10. class WordRiddleLevel
  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\OneToOne(targetEntity=WordRiddle::class, cascade={"persist", "remove"})
  28. */
  29. private $wordRiddle;
  30. /**
  31. * @ORM\Column(type="boolean")
  32. */
  33. private $isPublished;
  34. /**
  35. * @ORM\Column(type="string", length=191, nullable=true)
  36. */
  37. private $slug;
  38. /**
  39. * @ORM\OneToMany(targetEntity=WordRiddleParticipation::class, mappedBy="level")
  40. */
  41. private $participations;
  42. /**
  43. * @ORM\ManyToOne(targetEntity=WordRiddleGame::class, inversedBy="levels")
  44. */
  45. private $game;
  46. public function __construct()
  47. {
  48. $this->participations = new ArrayCollection();
  49. }
  50. public function getId(): ?int
  51. {
  52. return $this->id;
  53. }
  54. public function getLevelNumber(): ?int
  55. {
  56. return $this->levelNumber;
  57. }
  58. public function setLevelNumber(int $levelNumber): self
  59. {
  60. $this->levelNumber = $levelNumber;
  61. return $this;
  62. }
  63. public function getDifficulty(): ?string
  64. {
  65. return $this->difficulty;
  66. }
  67. public function setDifficulty(?string $difficulty): self
  68. {
  69. $this->difficulty = $difficulty;
  70. return $this;
  71. }
  72. public function getWordRiddle(): ?WordRiddle
  73. {
  74. return $this->wordRiddle;
  75. }
  76. public function setWordRiddle(?WordRiddle $wordRiddle): self
  77. {
  78. $this->wordRiddle = $wordRiddle;
  79. return $this;
  80. }
  81. public function isIsPublished(): ?bool
  82. {
  83. return $this->isPublished;
  84. }
  85. public function setIsPublished(bool $isPublished): self
  86. {
  87. $this->isPublished = $isPublished;
  88. return $this;
  89. }
  90. public function getSlug(): ?string
  91. {
  92. return $this->slug;
  93. }
  94. public function setSlug(?string $slug): self
  95. {
  96. $this->slug = $slug;
  97. return $this;
  98. }
  99. /**
  100. * @return Collection<int, WordRiddleParticipation>
  101. */
  102. public function getParticipations(): Collection
  103. {
  104. return $this->participations;
  105. }
  106. public function addParticipation(WordRiddleParticipation $participation): self
  107. {
  108. if (!$this->participations->contains($participation)) {
  109. $this->participations[] = $participation;
  110. $participation->setLevel($this);
  111. }
  112. return $this;
  113. }
  114. public function removeParticipation(WordRiddleParticipation $participation): self
  115. {
  116. if ($this->participations->removeElement($participation)) {
  117. // set the owning side to null (unless already changed)
  118. if ($participation->getLevel() === $this) {
  119. $participation->setLevel(null);
  120. }
  121. }
  122. return $this;
  123. }
  124. public function getGame(): ?WordRiddleGame
  125. {
  126. return $this->game;
  127. }
  128. public function setGame(?WordRiddleGame $game): self
  129. {
  130. $this->game = $game;
  131. return $this;
  132. }
  133. }