AccessWish.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\AccessWish;
  4. use App\Entity\Access\Access;
  5. use App\Entity\Core\Country;
  6. use App\Entity\Core\File;
  7. use App\Entity\Core\Tagg;
  8. use App\Entity\Organization\Organization;
  9. //use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  10. use Doctrine\Common\Collections\ArrayCollection;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Doctrine\Common\Collections\Collection;
  13. /**
  14. * Classe ... qui ...
  15. */
  16. //#[Auditable]
  17. #[ORM\Entity]
  18. class AccessWish
  19. {
  20. #[ORM\Id]
  21. #[ORM\Column]
  22. #[ORM\GeneratedValue]
  23. private ?int $id = null;
  24. #[ORM\ManyToOne]
  25. #[ORM\JoinColumn(nullable: false)]
  26. private Organization $organization;
  27. #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'accessWishes')]
  28. #[ORM\JoinColumn(onDelete: 'CASCADE')]
  29. private Access $accessOriginal;
  30. #[ORM\ManyToOne(inversedBy: 'accessWishes')]
  31. private AccessFamilyWish $accessFamilyWish;
  32. #[ORM\ManyToOne]
  33. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: false, onDelete: 'SET NULL')]
  34. private File $image;
  35. #[ORM\ManyToOne]
  36. private Country $addressCountry;
  37. #[ORM\OneToMany(mappedBy: 'accessWish', targetEntity: EducationStudentWish::class, cascade: ['persist'], orphanRemoval: true)]
  38. private Collection $educationStudentWishes;
  39. #[ORM\OneToMany(mappedBy: 'accessWishReregistrations', targetEntity: EducationStudentWish::class, cascade: ['persist'], orphanRemoval: true)]
  40. private Collection $educationStudentReregistrationsWishes;
  41. #[ORM\OneToMany(mappedBy: 'accessWish', targetEntity: DocumentWish::class, cascade: ['persist'])]
  42. private Collection $documentWishes;
  43. #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'accessWishes', cascade: ['persist'])]
  44. #[ORM\JoinTable(name: 'tag_accessWish')]
  45. #[ORM\JoinColumn(name: 'accessWish_id', referencedColumnName: 'id')]
  46. #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
  47. private Collection $tags;
  48. public function __construct()
  49. {
  50. $this->educationStudentWishes = new ArrayCollection();
  51. $this->educationStudentReregistrationsWishes = new ArrayCollection();
  52. $this->documentWishes = new ArrayCollection();
  53. $this->tags = new ArrayCollection();
  54. }
  55. public function getId(): ?int
  56. {
  57. return $this->id;
  58. }
  59. public function getOrganization(): ?Organization
  60. {
  61. return $this->organization;
  62. }
  63. public function setOrganization(?Organization $organization): self
  64. {
  65. $this->organization = $organization;
  66. return $this;
  67. }
  68. public function getAccessOriginal(): ?Access
  69. {
  70. return $this->accessOriginal;
  71. }
  72. public function setAccessOriginal(?Access $accessOriginal): self
  73. {
  74. $this->accessOriginal = $accessOriginal;
  75. return $this;
  76. }
  77. public function getAccessFamilyWish(): ?AccessFamilyWish
  78. {
  79. return $this->accessFamilyWish;
  80. }
  81. public function setAccessFamilyWish(?AccessFamilyWish $accessFamilyWish): self
  82. {
  83. $this->accessFamilyWish = $accessFamilyWish;
  84. return $this;
  85. }
  86. public function getImage(): ?File
  87. {
  88. return $this->image;
  89. }
  90. public function setImage(?File $image): self
  91. {
  92. $this->image = $image;
  93. return $this;
  94. }
  95. public function getAddressCountry(): ?Country
  96. {
  97. return $this->addressCountry;
  98. }
  99. public function setAddressCountry(?Country $addressCountry): self
  100. {
  101. $this->addressCountry = $addressCountry;
  102. return $this;
  103. }
  104. /**
  105. * @return Collection<int, EducationStudentWish>
  106. */
  107. public function getEducationStudentWishes(): Collection
  108. {
  109. return $this->educationStudentWishes;
  110. }
  111. public function addEducationStudentWish(EducationStudentWish $educationStudentWish): self
  112. {
  113. if (!$this->educationStudentWishes->contains($educationStudentWish)) {
  114. $this->educationStudentWishes[] = $educationStudentWish;
  115. $educationStudentWish->setAccessWish($this);
  116. }
  117. return $this;
  118. }
  119. public function removeEducationStudentWish(EducationStudentWish $educationStudentWish): self
  120. {
  121. if ($this->educationStudentWishes->removeElement($educationStudentWish)) {
  122. // set the owning side to null (unless already changed)
  123. if ($educationStudentWish->getAccessWish() === $this) {
  124. $educationStudentWish->setAccessWish(null);
  125. }
  126. }
  127. return $this;
  128. }
  129. /**
  130. * @return Collection<int, EducationStudentWish>
  131. */
  132. public function getEducationStudentReregistrationsWishes(): Collection
  133. {
  134. return $this->educationStudentReregistrationsWishes;
  135. }
  136. public function addEducationStudentReregistrationsWish(EducationStudentWish $educationStudentReregistrationsWish): self
  137. {
  138. if (!$this->educationStudentReregistrationsWishes->contains($educationStudentReregistrationsWish)) {
  139. $this->educationStudentReregistrationsWishes[] = $educationStudentReregistrationsWish;
  140. $educationStudentReregistrationsWish->setAccessWishReregistrations($this);
  141. }
  142. return $this;
  143. }
  144. public function removeEducationStudentReregistrationsWish(EducationStudentWish $educationStudentReregistrationsWish): self
  145. {
  146. if ($this->educationStudentReregistrationsWishes->removeElement($educationStudentReregistrationsWish)) {
  147. // set the owning side to null (unless already changed)
  148. if ($educationStudentReregistrationsWish->getAccessWishReregistrations() === $this) {
  149. $educationStudentReregistrationsWish->setAccessWishReregistrations(null);
  150. }
  151. }
  152. return $this;
  153. }
  154. /**
  155. * @return Collection<int, DocumentWish>
  156. */
  157. public function getDocumentWishes(): Collection
  158. {
  159. return $this->documentWishes;
  160. }
  161. public function addDocumentWish(DocumentWish $documentWish): self
  162. {
  163. if (!$this->documentWishes->contains($documentWish)) {
  164. $this->documentWishes[] = $documentWish;
  165. $documentWish->setAccessWish($this);
  166. }
  167. return $this;
  168. }
  169. public function removeDocumentWish(DocumentWish $documentWish): self
  170. {
  171. if ($this->documentWishes->removeElement($documentWish)) {
  172. // set the owning side to null (unless already changed)
  173. if ($documentWish->getAccessWish() === $this) {
  174. $documentWish->setAccessWish(null);
  175. }
  176. }
  177. return $this;
  178. }
  179. /**
  180. * @return Collection<int, Tagg>
  181. */
  182. public function getTags(): Collection
  183. {
  184. return $this->tags;
  185. }
  186. public function addTag(Tagg $tag): self
  187. {
  188. if (!$this->tags->contains($tag)) {
  189. $this->tags[] = $tag;
  190. }
  191. return $this;
  192. }
  193. public function removeTag(Tagg $tag): self
  194. {
  195. $this->tags->removeElement($tag);
  196. return $this;
  197. }
  198. }