vendor/croisiland/common-bundle/src/Entity/Company/Booklet.php line 24

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 Croisiland\CommonBundle\Annotation\Company\BookletFormValidator;
  7. use Croisiland\CommonBundle\Entity\Ship\Ship;
  8. use Croisiland\CommonBundle\Entity\Traits\IsVisibleTrait;
  9. use Croisiland\CommonBundle\Entity\Traits\ListOrderTrait;
  10. use Croisiland\CommonBundle\Repository\Company\BookletRepository;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\Common\Util\ClassUtils;
  14. use Doctrine\ORM\Mapping as ORM;
  15. /**
  16. * @ORM\Entity(repositoryClass=BookletRepository::class)
  17. *
  18. * @BookletFormValidator(groups={"booklet_form_validator"})
  19. */
  20. class Booklet implements MediaTagOwnerInterface
  21. {
  22. // TODO propertiés
  23. // true when image is created from command
  24. // private bool $auto = false;
  25. use ListOrderTrait;
  26. use IsVisibleTrait;
  27. use LifecycleUserIdentifierTrait;
  28. /**
  29. * @ORM\Id
  30. *
  31. * @ORM\GeneratedValue
  32. *
  33. * @ORM\Column(type="integer")
  34. */
  35. private ?int $id;
  36. /**
  37. * @ORM\Column(type="string", length=255)
  38. */
  39. private ?string $name = null;
  40. /**
  41. * @ORM\Column(type="text", nullable=true)
  42. */
  43. private ?string $description = null;
  44. /**
  45. * @ORM\Column(type="integer", nullable=true)
  46. */
  47. private ?int $thumbnailPdfPageNumber = null;
  48. /**
  49. * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="booklets")
  50. *
  51. * @ORM\JoinColumn(nullable=false)
  52. */
  53. private ?Company $company = null;
  54. /**
  55. * @var Collection<int, Ship>
  56. *
  57. * @ORM\ManyToMany(targetEntity=Ship::class, inversedBy="booklets")
  58. */
  59. private Collection $ships;
  60. public function __construct()
  61. {
  62. $this->ships = new ArrayCollection();
  63. }
  64. public function getId(): ?int
  65. {
  66. return $this->id;
  67. }
  68. public function getName(): ?string
  69. {
  70. return $this->name;
  71. }
  72. public function setName(?string $name): self
  73. {
  74. $this->name = $name;
  75. return $this;
  76. }
  77. public function getDescription(): ?string
  78. {
  79. return $this->description;
  80. }
  81. public function setDescription(?string $description): self
  82. {
  83. $this->description = $description;
  84. return $this;
  85. }
  86. public function getThumbnailPdfPageNumber(): ?int
  87. {
  88. return $this->thumbnailPdfPageNumber;
  89. }
  90. public function setThumbnailPdfPageNumber(?int $thumbnailPdfPageNumber): self
  91. {
  92. $this->thumbnailPdfPageNumber = $thumbnailPdfPageNumber;
  93. return $this;
  94. }
  95. public function getCompany(): ?Company
  96. {
  97. return $this->company;
  98. }
  99. public function setCompany(?Company $company): self
  100. {
  101. $this->company = $company;
  102. return $this;
  103. }
  104. /**
  105. * @return Collection<int, Ship>
  106. */
  107. public function getShips(): Collection
  108. {
  109. return $this->ships;
  110. }
  111. public function addShip(Ship $ship): self
  112. {
  113. if (!$this->ships->contains($ship)) {
  114. $this->ships[] = $ship;
  115. }
  116. return $this;
  117. }
  118. public function removeShip(Ship $ship): self
  119. {
  120. $this->ships->removeElement($ship);
  121. return $this;
  122. }
  123. /**
  124. * Method liée au Média Bundle
  125. */
  126. public function getMediaTagOwnerLabel(): ?string
  127. {
  128. return $this->getName();
  129. }
  130. /**
  131. * Method liée au Média Bundle
  132. * @return class-string
  133. */
  134. public function getFqcn(): string
  135. {
  136. return ClassUtils::getClass($this);
  137. }
  138. }