src/Entity/Inscription.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\InscriptionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=InscriptionRepository::class)
  9. */
  10. class Inscription
  11. {
  12. const OPEN = "open";
  13. const PART = "part";
  14. const PAID = "complete";
  15. const CANCELLED = "cancelled";
  16. const OPTION = "option";
  17. /**
  18. * @ORM\Id
  19. * @ORM\GeneratedValue
  20. * @ORM\Column(type="integer")
  21. */
  22. private $id;
  23. /**
  24. * @ORM\ManyToOne(targetEntity=Contact::class, inversedBy="inscriptions",cascade={"persist"})
  25. * @ORM\JoinColumn(nullable=true)
  26. */
  27. private $enfant;
  28. /**
  29. * @ORM\ManyToOne(targetEntity=Contact::class, inversedBy="inscriptionParents",cascade={"persist"})
  30. * @ORM\JoinColumn(nullable=true)
  31. */
  32. private $parent;
  33. /**
  34. * @ORM\ManyToOne(targetEntity=Contact::class, inversedBy="inscriptionParents",cascade={"persist"})
  35. * @ORM\JoinColumn(nullable=true)
  36. */
  37. private $responsable;
  38. /**
  39. * @ORM\ManyToOne(targetEntity=SejourSession::class, inversedBy="inscriptions", fetch="EAGER")
  40. * @ORM\JoinColumn(nullable=false)
  41. */
  42. private $sejourSession;
  43. /**
  44. * @ORM\OneToMany(targetEntity=Compta::class, mappedBy="inscription", cascade={"remove"})
  45. */
  46. private $comptas;
  47. /**
  48. * @ORM\OneToMany(targetEntity=TiersDeConfiance::class, mappedBy="inscription", cascade={"remove"})
  49. */
  50. private $tiersDeConfiance;
  51. /**
  52. * @ORM\ManyToOne(targetEntity=MajorationTransport::class, inversedBy="inscriptions")
  53. */
  54. private $majorationTransportAller;
  55. /**
  56. * @ORM\ManyToOne(targetEntity=MajorationTransport::class, inversedBy="inscriptionsRetour")
  57. */
  58. private $majorationTransportRetour;
  59. /**
  60. * @ORM\Column(type="boolean", nullable=true)
  61. */
  62. private $isGOA;
  63. /**
  64. * @ORM\Column(type="string", length=255, nullable=true)
  65. */
  66. private $origin;
  67. /**
  68. * @ORM\ManyToOne(targetEntity=Commande::class, inversedBy="inscription",cascade={"persist"})
  69. */
  70. private $commande;
  71. /**
  72. * @ORM\OneToMany(targetEntity=Media::class, mappedBy="inscription", cascade={"remove"})
  73. */
  74. private $medias;
  75. /**
  76. * @ORM\Column(type="integer", nullable=true)
  77. */
  78. private $legacyId;
  79. /**
  80. * @ORM\Column(type="string", length=50, nullable=true)
  81. */
  82. private $statut;
  83. /**
  84. * @ORM\Column(type="string", length=50, nullable=true)
  85. */
  86. private $trancheAge;
  87. /**
  88. * @ORM\Column(type="string", length=50, nullable=true)
  89. */
  90. private $code;
  91. /**
  92. * @ORM\ManyToOne(targetEntity=EnterpriseOptionSejourSession::class, inversedBy="inscriptions")
  93. */
  94. private $enterpriseOptionSejourSession;
  95. /**
  96. * @ORM\Column(type="datetime_immutable")
  97. */
  98. private $createdDate;
  99. /**
  100. * @ORM\Column(type="datetime", nullable= true)
  101. */
  102. private $updatedDate;
  103. /**
  104. * @ORM\OneToMany(targetEntity=ContactForFamilleAccueil::class, mappedBy="inscription",cascade={"persist"})
  105. */
  106. private $contactForFamilleAccueils;
  107. public function getContactForFamilleAccueils(): Collection
  108. {
  109. return $this->contactForFamilleAccueils;
  110. }
  111. public function addContactForFamilleAccueil(ContactForFamilleAccueil $contact): self
  112. {
  113. if (!$this->contactForFamilleAccueils->contains($contact)) {
  114. $this->contactForFamilleAccueils[] = $contact;
  115. $contact->setInscription($this);
  116. }
  117. return $this;
  118. }
  119. public function __construct()
  120. {
  121. $this->comptas = new ArrayCollection();
  122. $this->medias = new ArrayCollection();
  123. $this->contactForFamilleAccueils = new ArrayCollection();
  124. $this->createdDate = new \DateTimeImmutable();
  125. $this->updatedDate = new \DateTime();
  126. }
  127. public function getId(): ?int
  128. {
  129. return $this->id;
  130. }
  131. public function getEnfant(): ?Contact
  132. {
  133. return $this->enfant;
  134. }
  135. public function setEnfant(?Contact $enfant): self
  136. {
  137. $this->enfant = $enfant;
  138. return $this;
  139. }
  140. public function getParent(): ?Contact
  141. {
  142. return $this->parent;
  143. }
  144. public function setParent(?Contact $parent): self
  145. {
  146. $this->parent = $parent;
  147. return $this;
  148. }
  149. public function getResponsable(): ?Contact
  150. {
  151. return $this->responsable;
  152. }
  153. public function setResponsable(?Contact $responsable): self
  154. {
  155. $this->responsable = $responsable;
  156. return $this;
  157. }
  158. public function getSejourSession(): ?SejourSession
  159. {
  160. return $this->sejourSession;
  161. }
  162. public function setSejourSession(?SejourSession $sejourSession): self
  163. {
  164. $this->sejourSession = $sejourSession;
  165. return $this;
  166. }
  167. /**
  168. * @return Collection|TiersDeConfiance[]
  169. */
  170. public function getTiersDeConfiance(): Collection
  171. {
  172. return $this->tiersDeConfiance;
  173. }
  174. public function addTiersDeConfiance(TiersDeConfiance $compta): self
  175. {
  176. if (!$this->tiersDeConfiance->contains($compta)) {
  177. $this->tiersDeConfiance[] = $compta;
  178. $compta->setInscription($this);
  179. }
  180. return $this;
  181. }
  182. public function removeTiersDeConfiance(TiersDeConfiance $compta): self
  183. {
  184. if ($this->tiersDeConfiance->removeElement($compta)) {
  185. // set the owning side to null (unless already changed)
  186. if ($compta->getInscription() === $this) {
  187. $compta->setInscription(null);
  188. }
  189. }
  190. return $this;
  191. }
  192. /**
  193. * @return Collection|Compta[]
  194. */
  195. public function getComptas(): Collection
  196. {
  197. return $this->comptas;
  198. }
  199. public function addCompta(Compta $compta): self
  200. {
  201. if (!$this->comptas->contains($compta)) {
  202. $this->comptas[] = $compta;
  203. $compta->setInscription($this);
  204. }
  205. return $this;
  206. }
  207. public function removeCompta(Compta $compta): self
  208. {
  209. if ($this->comptas->removeElement($compta)) {
  210. // set the owning side to null (unless already changed)
  211. if ($compta->getInscription() === $this) {
  212. $compta->setInscription(null);
  213. }
  214. }
  215. return $this;
  216. }
  217. public function getMajorationTransportAller(): ?MajorationTransport
  218. {
  219. return $this->majorationTransportAller;
  220. }
  221. public function setMajorationTransportAller(?MajorationTransport $majorationTransportAller): self
  222. {
  223. $this->majorationTransportAller = $majorationTransportAller;
  224. return $this;
  225. }
  226. public function getMajorationTransportRetour(): ?MajorationTransport
  227. {
  228. return $this->majorationTransportRetour;
  229. }
  230. public function setMajorationTransportRetour(?MajorationTransport $majorationTransportRetour): self
  231. {
  232. $this->majorationTransportRetour = $majorationTransportRetour;
  233. return $this;
  234. }
  235. public function getIsGOA(): ?bool
  236. {
  237. return $this->isGOA;
  238. }
  239. public function setIsGOA(?bool $isGOA): self
  240. {
  241. $this->isGOA = $isGOA;
  242. return $this;
  243. }
  244. public function getOrigin(): ?string
  245. {
  246. return $this->origin;
  247. }
  248. public function setOrigin(?string $origin): self
  249. {
  250. $this->origin = $origin;
  251. return $this;
  252. }
  253. public function getCommande(): ?Commande
  254. {
  255. return $this->commande;
  256. }
  257. public function setCommande(?Commande $commande): self
  258. {
  259. $this->commande = $commande;
  260. return $this;
  261. }
  262. /**
  263. * @return Collection|Media[]
  264. */
  265. public function getMedias(): Collection
  266. {
  267. return $this->medias;
  268. }
  269. public function addMedia(Media $media): self
  270. {
  271. if (!$this->medias->contains($media)) {
  272. $this->medias[] = $media;
  273. $media->setInscription($this);
  274. }
  275. return $this;
  276. }
  277. public function removeMedia(Media $media): self
  278. {
  279. if ($this->medias->removeElement($media)) {
  280. // set the owning side to null (unless already changed)
  281. if ($media->getInscription() === $this) {
  282. $media->setInscription(null);
  283. }
  284. }
  285. return $this;
  286. }
  287. public function getLegacyId(): ?int
  288. {
  289. return $this->legacyId;
  290. }
  291. public function setLegacyId(?int $legacyId): self
  292. {
  293. $this->legacyId = $legacyId;
  294. return $this;
  295. }
  296. public function getStatut(): ?string
  297. {
  298. return $this->statut;
  299. }
  300. public function setStatut(?string $statut): self
  301. {
  302. $this->statut = $statut;
  303. return $this;
  304. }
  305. public function getTrancheAge(): ?string
  306. {
  307. return $this->trancheAge;
  308. }
  309. public function setTrancheAge(?string $statut): self
  310. {
  311. $this->trancheAge = $statut;
  312. return $this;
  313. }
  314. public function getCode(): ?string
  315. {
  316. return $this->code;
  317. }
  318. public function setCode(?string $code): self
  319. {
  320. $this->code = $code;
  321. return $this;
  322. }
  323. public function getEnterpriseOptionSejourSession(): ?EnterpriseOptionSejourSession
  324. {
  325. return $this->enterpriseOptionSejourSession;
  326. }
  327. public function setEnterpriseOptionSejourSession(?EnterpriseOptionSejourSession $enterpriseOptionSejourSession): self
  328. {
  329. $this->enterpriseOptionSejourSession = $enterpriseOptionSejourSession;
  330. return $this;
  331. }
  332. public function getCreatedDate(): ?\DateTimeImmutable
  333. {
  334. return $this->createdDate;
  335. }
  336. public function setCreatedDate(\DateTimeImmutable $createdDate): self
  337. {
  338. $this->createdDate = $createdDate;
  339. return $this;
  340. }
  341. public function getUpdatedDate(): ?\DateTime
  342. {
  343. return $this->updatedDate;
  344. }
  345. public function setUpdatedDate(\DateTime $createdDate): self
  346. {
  347. $this->updatedDate = $createdDate;
  348. return $this;
  349. }
  350. public function getPaiementOverview(): array
  351. {
  352. $output = [];
  353. foreach ($this->comptas as $compta) {
  354. $output[$compta->getStatut()] = array_key_exists($compta->getStatut(), $output) ? $output[$compta->getStatut()] + $compta->getValeur() : $compta->getValeur();
  355. }
  356. return $output;
  357. }
  358. }