src/Entity/EnterpriseOptionSejourSession.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EnterpriseOptionSejourSessionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=EnterpriseOptionSejourSessionRepository::class)
  9. */
  10. class EnterpriseOptionSejourSession
  11. {
  12. const OPEN = "open";
  13. const VALIDATED = "validated";
  14. const REFUSED = "refused";
  15. /**
  16. * @ORM\Id
  17. * @ORM\GeneratedValue
  18. * @ORM\Column(type="integer")
  19. */
  20. private $id;
  21. /**
  22. * @ORM\ManyToOne(targetEntity=Enterprise::class, inversedBy="enterpriseOptionSejourSessions")
  23. * @ORM\JoinColumn(nullable=false)
  24. */
  25. private $enterprise;
  26. /**
  27. * @ORM\ManyToOne(targetEntity=EnterpriseRequest::class, inversedBy="enterpriseOptionSejourSessions")
  28. * @ORM\JoinColumn(nullable=true)
  29. */
  30. private $enterpriseRequest;
  31. /**
  32. * @ORM\ManyToOne(targetEntity=SejourSession::class, inversedBy="enterpriseOptionSejourSessions")
  33. */
  34. private $sejourSession;
  35. /**
  36. * @ORM\Column(type="integer")
  37. */
  38. private $nbreSouhaite;
  39. /**
  40. * @ORM\Column(type="integer", nullable=true)
  41. */
  42. private $nbreBooke;
  43. /**
  44. * @ORM\Column(type="datetime")
  45. */
  46. private $creationDate;
  47. /**
  48. * @ORM\Column(type="datetime")
  49. */
  50. private $endDate;
  51. /**
  52. * @ORM\OneToMany(targetEntity=Inscription::class, mappedBy="enterpriseOptionSejourSession")
  53. */
  54. private $inscriptions;
  55. /**
  56. * @ORM\Column(type="string", length=50, nullable=true)
  57. */
  58. private $statut;
  59. /**
  60. * @ORM\OneToMany(targetEntity=Commande::class, mappedBy="enterpriseOptionSejourSession")
  61. */
  62. private $commandes;
  63. /**
  64. * @ORM\Column(type="boolean", nullable=true)
  65. */
  66. private $isIndividuel;
  67. public function __construct()
  68. {
  69. $this->inscriptions = new ArrayCollection();
  70. $this->creationDate = new \Datetime();
  71. $this->nbreBooke = 0;
  72. $this->statut = self::OPEN;
  73. $this->commandes = new ArrayCollection();
  74. }
  75. public function getId(): ?int
  76. {
  77. return $this->id;
  78. }
  79. public function getEnterprise(): ?Enterprise
  80. {
  81. return $this->enterprise;
  82. }
  83. public function setEnterprise(?Enterprise $enterprise): self
  84. {
  85. $this->enterprise = $enterprise;
  86. return $this;
  87. }
  88. public function getEnterpriseRequest()
  89. {
  90. return $this->enterpriseRequest;
  91. }
  92. public function setEnterpriseRequest(?EnterpriseRequest $enterpriseRequest): self
  93. {
  94. $this->enterpriseRequest = $enterpriseRequest;
  95. return $this;
  96. }
  97. public function getSejourSession(): ?SejourSession
  98. {
  99. return $this->sejourSession;
  100. }
  101. public function setSejourSession(?SejourSession $sejourSession): self
  102. {
  103. $this->sejourSession = $sejourSession;
  104. return $this;
  105. }
  106. public function getNbreSouhaite(): ?int
  107. {
  108. return $this->nbreSouhaite;
  109. }
  110. public function setNbreSouhaite(int $nbre_souhaite): self
  111. {
  112. $this->nbreSouhaite = $nbre_souhaite;
  113. return $this;
  114. }
  115. public function getNbreBooke(): ?int
  116. {
  117. return $this->nbreBooke;
  118. }
  119. public function getNbreBooke2(): ?int
  120. {
  121. $count = 0;
  122. foreach($this->inscriptions as $inscription){
  123. if($inscription->getStatut() !== Inscription::CANCELLED)
  124. $count ++;
  125. }
  126. }
  127. public function setNbreBooke(?int $nbre_booke): self
  128. {
  129. $this->nbreBooke = $nbre_booke;
  130. return $this;
  131. }
  132. public function getCreationDate(): ?\DateTimeInterface
  133. {
  134. return $this->creationDate;
  135. }
  136. public function setCreationDate(\DateTimeInterface $creationDate): self
  137. {
  138. $this->creationDate = $creationDate;
  139. return $this;
  140. }
  141. public function getEndDate(): ?\DateTimeInterface
  142. {
  143. return $this->endDate;
  144. }
  145. public function setEndDate(\DateTimeInterface $endDate): self
  146. {
  147. $this->endDate = $endDate;
  148. return $this;
  149. }
  150. /**
  151. * @return Collection|Inscription[]
  152. */
  153. public function getInscriptions(): Collection
  154. {
  155. return $this->inscriptions;
  156. }
  157. /**
  158. * @return Collection|Inscription[]
  159. */
  160. public function getInscriptionsValides(): array
  161. {
  162. $output = [];
  163. foreach( $this->inscriptions as $inscription)
  164. if($inscription->getStatut()!== Inscription::CANCELLED) $output[]=$inscription;
  165. return $output;
  166. }
  167. public function addInscription(Inscription $inscription): self
  168. {
  169. if (!$this->inscriptions->contains($inscription)) {
  170. $this->inscriptions[] = $inscription;
  171. $inscription->setEnterpriseOptionSejourSession($this);
  172. }
  173. return $this;
  174. }
  175. public function removeInscription(Inscription $inscription): self
  176. {
  177. if ($this->inscriptions->removeElement($inscription)) {
  178. // set the owning side to null (unless already changed)
  179. if ($inscription->getEnterpriseOptionSejourSession() === $this) {
  180. $inscription->setEnterpriseOptionSejourSession(null);
  181. }
  182. }
  183. return $this;
  184. }
  185. public function getStatut(): ?string
  186. {
  187. return $this->statut;
  188. }
  189. public function setStatut(?string $statut): self
  190. {
  191. $this->statut = $statut;
  192. return $this;
  193. }
  194. /**
  195. * @return Collection<int, Commande>
  196. */
  197. public function getCommandes(): Collection
  198. {
  199. return $this->commandes;
  200. }
  201. public function addCommande(Commande $commande): self
  202. {
  203. if (!$this->commandes->contains($commande)) {
  204. $this->commandes[] = $commande;
  205. $commande->setEnterpriseOptionSejourSession($this);
  206. }
  207. return $this;
  208. }
  209. public function removeCommande(Commande $commande): self
  210. {
  211. if ($this->commandes->removeElement($commande)) {
  212. // set the owning side to null (unless already changed)
  213. if ($commande->getEnterpriseOptionSejourSession() === $this) {
  214. $commande->setEnterpriseOptionSejourSession(null);
  215. }
  216. }
  217. return $this;
  218. }
  219. public function isIsIndividuel(): ?bool
  220. {
  221. return $this->isIndividuel;
  222. }
  223. public function setIsIndividuel(?bool $isIndividuel): self
  224. {
  225. $this->isIndividuel = $isIndividuel;
  226. return $this;
  227. }
  228. }