vendor/croisiland/common-bundle/src/Entity/Company/Atmosphere.php line 35

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Croisiland\CommonBundle\Entity\Company;
  4. use Crea\MediaBundle\Entity\MediaTagOwnerInterface;
  5. use Crea\ToolsBundle\Entity\LifecycleUserIdentifierTrait;
  6. use Crea\ToolsBundle\Traits\KeyValueTrait;
  7. use Croisiland\CommonBundle\Annotation\Company\AtmosphereFormValidator;
  8. use Croisiland\CommonBundle\Entity\Amenity\ServiceAtmosphereAssociation;
  9. use Croisiland\CommonBundle\Entity\Cabin\CabinCategory;
  10. use Croisiland\CommonBundle\Entity\Ship\OnBoardLife;
  11. use Croisiland\CommonBundle\Entity\Traits\IsActiveTrait;
  12. use Croisiland\CommonBundle\Entity\Traits\IsVisibleTrait;
  13. use Croisiland\CommonBundle\Entity\Traits\ListOrderTrait;
  14. use Croisiland\CommonBundle\Repository\Company\AtmosphereRepository;
  15. use Doctrine\Common\Collections\ArrayCollection;
  16. use Doctrine\Common\Collections\Collection;
  17. use Doctrine\Common\Util\ClassUtils;
  18. use Doctrine\ORM\Mapping as ORM;
  19. /**
  20. * @ORM\Entity(repositoryClass=AtmosphereRepository::class)
  21. *
  22. * @ORM\Table(
  23. * uniqueConstraints={
  24. *
  25. * @ORM\UniqueConstraint(name="atmosphere_code_unique", columns={"code", "company_id"})
  26. * }
  27. * )
  28. *
  29. * @AtmosphereFormValidator(groups={"atmosphere_form_validator"})
  30. */
  31. class Atmosphere implements MediaTagOwnerInterface
  32. {
  33. use ListOrderTrait;
  34. use IsActiveTrait;
  35. use LifecycleUserIdentifierTrait;
  36. use KeyValueTrait;
  37. // TODO: relations
  38. // private Collection images;
  39. /**
  40. * @ORM\Id
  41. *
  42. * @ORM\GeneratedValue
  43. *
  44. * @ORM\Column(type="integer")
  45. */
  46. private ?int $id = null;
  47. /**
  48. * @ORM\Column(type="string", length=255)
  49. */
  50. private ?string $name = null;
  51. /**
  52. * @ORM\Column(type="string", length=255, nullable=true)
  53. */
  54. private ?string $marketingName = null;
  55. /**
  56. * @ORM\Column(type="string", length=255)
  57. */
  58. private ?string $code = null;
  59. /**
  60. * @ORM\Column(type="text", nullable=true)
  61. */
  62. private ?string $shortDescription = null;
  63. /**
  64. * @ORM\Column(type="text", nullable=true)
  65. */
  66. private ?string $description = null;
  67. /**
  68. * @ORM\Column(type="text", nullable=true)
  69. */
  70. private ?string $comment = null;
  71. /**
  72. * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="atmospheres")
  73. *
  74. * @ORM\JoinColumn(nullable=false)
  75. */
  76. private ?Company $company = null;
  77. /**
  78. * @var Collection<int, CabinCategory>
  79. *
  80. * @ORM\OneToMany(targetEntity=CabinCategory::class, mappedBy="atmosphere")
  81. * @ORM\OrderBy({"listOrder" = "ASC"})
  82. */
  83. private Collection $cabinCategories;
  84. /**
  85. * @var Collection<int, OnBoardLife>
  86. *
  87. * @ORM\OneToMany(targetEntity=OnBoardLife::class, mappedBy="atmosphere")
  88. */
  89. private Collection $onBoardLives;
  90. /**
  91. * @ORM\Column(type="text", nullable=true)
  92. */
  93. private ?string $included = null;
  94. /**
  95. * @ORM\Column(type="text", nullable=true)
  96. */
  97. private ?string $excluded = null;
  98. /**
  99. * @var Collection<int, ServiceAtmosphereAssociation>
  100. *
  101. * @ORM\OneToMany(targetEntity=ServiceAtmosphereAssociation::class, mappedBy="atmosphere", orphanRemoval=true, cascade={"persist","remove"})
  102. */
  103. private Collection $serviceAtmosphereAssociations;
  104. /**
  105. * @ORM\ManyToOne(targetEntity=Atmosphere::class)
  106. * @ORM\JoinColumn(nullable=true)
  107. */
  108. private ?Atmosphere $inheritsServicesFrom = null;
  109. /**
  110. * @ORM\Column(type="text", nullable=true)
  111. */
  112. private ?string $reassignment = null;
  113. public function __construct()
  114. {
  115. $this->cabinCategories = new ArrayCollection();
  116. $this->onBoardLives = new ArrayCollection();
  117. $this->serviceAtmosphereAssociations = new ArrayCollection();
  118. }
  119. public function getId(): ?int
  120. {
  121. return $this->id;
  122. }
  123. public function getName(): ?string
  124. {
  125. return $this->name;
  126. }
  127. public function setName(?string $name): self
  128. {
  129. $this->name = $name;
  130. return $this;
  131. }
  132. public function getMarketingName(): ?string
  133. {
  134. return $this->marketingName;
  135. }
  136. public function setMarketingName(?string $marketingName): self
  137. {
  138. $this->marketingName = $marketingName;
  139. return $this;
  140. }
  141. public function getCode(): ?string
  142. {
  143. return $this->code;
  144. }
  145. public function setCode(string $code): self
  146. {
  147. $this->code = $code;
  148. return $this;
  149. }
  150. public function getShortDescription(): ?string
  151. {
  152. return $this->shortDescription;
  153. }
  154. public function setShortDescription(?string $shortDescription): Atmosphere
  155. {
  156. $this->shortDescription = $shortDescription;
  157. return $this;
  158. }
  159. public function getDescription(): ?string
  160. {
  161. return $this->description;
  162. }
  163. public function setDescription(?string $description): self
  164. {
  165. $this->description = $description;
  166. return $this;
  167. }
  168. public function getComment(): ?string
  169. {
  170. return $this->comment;
  171. }
  172. public function setComment(?string $comment): self
  173. {
  174. $this->comment = $comment;
  175. return $this;
  176. }
  177. public function getCompany(): ?Company
  178. {
  179. return $this->company;
  180. }
  181. public function setCompany(?Company $company): self
  182. {
  183. $this->company = $company;
  184. return $this;
  185. }
  186. /**
  187. * @return Collection<int, CabinCategory>
  188. */
  189. public function getCabinCategories(): Collection
  190. {
  191. return $this->cabinCategories;
  192. }
  193. public function addCabinCategory(CabinCategory $cabinCategory): self
  194. {
  195. if (!$this->cabinCategories->contains($cabinCategory)) {
  196. $this->cabinCategories[] = $cabinCategory;
  197. $cabinCategory->setAtmosphere($this);
  198. }
  199. return $this;
  200. }
  201. public function removeCabinCategory(CabinCategory $cabinCategory): self
  202. {
  203. if ($this->cabinCategories->removeElement($cabinCategory)) {
  204. // set the owning side to null (unless already changed)
  205. if ($cabinCategory->getAtmosphere() === $this) {
  206. $cabinCategory->setAtmosphere(null);
  207. }
  208. }
  209. return $this;
  210. }
  211. /**
  212. * @return Collection<int, OnBoardLife>
  213. */
  214. public function getOnBoardLives(): Collection
  215. {
  216. return $this->onBoardLives;
  217. }
  218. public function addOnBoardLife(OnBoardLife $onBoardLife): self
  219. {
  220. if (!$this->onBoardLives->contains($onBoardLife)) {
  221. $this->onBoardLives[] = $onBoardLife;
  222. $onBoardLife->setAtmosphere($this);
  223. }
  224. return $this;
  225. }
  226. public function removeOnBoardLife(OnBoardLife $onBoardLife): self
  227. {
  228. if ($this->onBoardLives->removeElement($onBoardLife)) {
  229. // set the owning side to null (unless already changed)
  230. if ($onBoardLife->getAtmosphere() === $this) {
  231. $onBoardLife->setAtmosphere(null);
  232. }
  233. }
  234. return $this;
  235. }
  236. public function getIncluded(): ?string
  237. {
  238. return $this->included;
  239. }
  240. public function setIncluded(?string $included): self
  241. {
  242. $this->included = $included;
  243. return $this;
  244. }
  245. public function getExcluded(): ?string
  246. {
  247. return $this->excluded;
  248. }
  249. public function setExcluded(?string $excluded): self
  250. {
  251. $this->excluded = $excluded;
  252. return $this;
  253. }
  254. /**
  255. * @return Collection<int, ServiceAtmosphereAssociation>
  256. */
  257. public function getServiceAtmosphereAssociations(): Collection
  258. {
  259. return $this->serviceAtmosphereAssociations;
  260. }
  261. public function addServiceAtmosphereAssociation(ServiceAtmosphereAssociation $serviceAtmosphereAssociation): self
  262. {
  263. if (!$this->serviceAtmosphereAssociations->contains($serviceAtmosphereAssociation)) {
  264. $this->serviceAtmosphereAssociations[] = $serviceAtmosphereAssociation;
  265. $serviceAtmosphereAssociation->setAtmosphere($this);
  266. }
  267. return $this;
  268. }
  269. public function removeServiceAtmosphereAssociation(ServiceAtmosphereAssociation $serviceAtmosphereAssociation): self
  270. {
  271. if ($this->serviceAtmosphereAssociations->removeElement($serviceAtmosphereAssociation)) {
  272. // set the owning side to null (unless already changed)
  273. if ($serviceAtmosphereAssociation->getAtmosphere() === $this) {
  274. $serviceAtmosphereAssociation->setAtmosphere(null);
  275. }
  276. }
  277. return $this;
  278. }
  279. public function getInheritsServicesFrom(): ?Atmosphere
  280. {
  281. return $this->inheritsServicesFrom;
  282. }
  283. public function setInheritsServicesFrom(?Atmosphere $inheritsServicesFrom): self
  284. {
  285. $this->inheritsServicesFrom = $inheritsServicesFrom;
  286. return $this;
  287. }
  288. public function getReassignment(): ?string
  289. {
  290. return $this->reassignment;
  291. }
  292. public function setReassignment(?string $reassignment): self
  293. {
  294. $this->reassignment = $reassignment;
  295. return $this;
  296. }
  297. /**
  298. * Method liée au Média Bundle
  299. */
  300. public function getMediaTagOwnerLabel(): ?string
  301. {
  302. return $this->getName();
  303. }
  304. /**
  305. * Method liée au Média Bundle
  306. * @return class-string
  307. */
  308. public function getFqcn(): string
  309. {
  310. return ClassUtils::getClass($this);
  311. }
  312. }