vendor/croisiland/common-bundle/src/Entity/Ship/OnBoardLife.php line 17

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Croisiland\CommonBundle\Entity\Ship;
  4. use Crea\ToolsBundle\Entity\LifecycleUserIdentifierTrait;
  5. use Croisiland\CommonBundle\Entity\Company\Atmosphere;
  6. use Croisiland\CommonBundle\Repository\Ship\OnBoardLifeRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11. * @ORM\Entity(repositoryClass=OnBoardLifeRepository::class)
  12. */
  13. class OnBoardLife
  14. {
  15. use LifecycleUserIdentifierTrait;
  16. /**
  17. * @ORM\Id
  18. *
  19. * @ORM\GeneratedValue
  20. *
  21. * @ORM\Column(type="integer")
  22. */
  23. private ?int $id;
  24. /**
  25. * @ORM\Column(type="string", length=255)
  26. */
  27. private string $name;
  28. /**
  29. * @ORM\Column(type="text", nullable=true)
  30. */
  31. private ?string $description;
  32. /**
  33. * @ORM\Column(type="string", length=255, nullable=true)
  34. */
  35. private ?string $thematic;
  36. /**
  37. * @ORM\Column(type="smallint", nullable=true)
  38. */
  39. private ?int $minAge;
  40. /**
  41. * @ORM\Column(type="smallint", nullable=true)
  42. */
  43. private ?int $maxAge;
  44. /**
  45. * @var Collection<int, OnBoardLifeCategory>
  46. *
  47. * @ORM\ManyToMany(targetEntity=OnBoardLifeCategory::class, inversedBy="onBoardLives")
  48. */
  49. private Collection $categories;
  50. /**
  51. * @ORM\ManyToOne(targetEntity=Atmosphere::class, inversedBy="onBoardLives")
  52. */
  53. private ?Atmosphere $atmosphere;
  54. /**
  55. * @var Collection<int, Ship>
  56. *
  57. * @ORM\ManyToMany(targetEntity=Ship::class, inversedBy="onBoardLives")
  58. */
  59. private Collection $ships;
  60. public function __construct()
  61. {
  62. $this->categories = new ArrayCollection();
  63. $this->ships = new ArrayCollection();
  64. }
  65. public function getId(): ?int
  66. {
  67. return $this->id;
  68. }
  69. public function getName(): ?string
  70. {
  71. return $this->name;
  72. }
  73. public function setName(string $name): self
  74. {
  75. $this->name = $name;
  76. return $this;
  77. }
  78. public function getDescription(): ?string
  79. {
  80. return $this->description;
  81. }
  82. public function setDescription(?string $description): self
  83. {
  84. $this->description = $description;
  85. return $this;
  86. }
  87. public function getThematic(): ?string
  88. {
  89. return $this->thematic;
  90. }
  91. public function setThematic(?string $thematic): self
  92. {
  93. $this->thematic = $thematic;
  94. return $this;
  95. }
  96. public function getMinAge(): ?int
  97. {
  98. return $this->minAge;
  99. }
  100. public function setMinAge(?int $minAge): self
  101. {
  102. $this->minAge = $minAge;
  103. return $this;
  104. }
  105. public function getMaxAge(): ?int
  106. {
  107. return $this->maxAge;
  108. }
  109. public function setMaxAge(?int $maxAge): self
  110. {
  111. $this->maxAge = $maxAge;
  112. return $this;
  113. }
  114. /**
  115. * @return Collection<int, OnBoardLifeCategory>
  116. */
  117. public function getCategories(): Collection
  118. {
  119. return $this->categories;
  120. }
  121. public function addCategory(OnBoardLifeCategory $category): self
  122. {
  123. if (!$this->categories->contains($category)) {
  124. $this->categories[] = $category;
  125. }
  126. return $this;
  127. }
  128. public function removeCategory(OnBoardLifeCategory $category): self
  129. {
  130. $this->categories->removeElement($category);
  131. return $this;
  132. }
  133. public function getAtmosphere(): ?Atmosphere
  134. {
  135. return $this->atmosphere;
  136. }
  137. public function setAtmosphere(?Atmosphere $atmosphere): self
  138. {
  139. $this->atmosphere = $atmosphere;
  140. return $this;
  141. }
  142. /**
  143. * @return Collection<int, Ship>
  144. */
  145. public function getShips(): Collection
  146. {
  147. return $this->ships;
  148. }
  149. public function addShip(Ship $ship): self
  150. {
  151. if (!$this->ships->contains($ship)) {
  152. $this->ships[] = $ship;
  153. }
  154. return $this;
  155. }
  156. public function removeShip(Ship $ship): self
  157. {
  158. $this->ships->removeElement($ship);
  159. return $this;
  160. }
  161. }