src/Entity/Candidature.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CandidatureRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=CandidatureRepository::class)
  9. * @ORM\HasLifecycleCallbacks()
  10. */
  11. class Candidature
  12. {
  13. const POSTED = "envoyée";
  14. const REJECTED = "rejetée";
  15. const ACCEPTED = "acceptée";
  16. /**
  17. * @ORM\Id
  18. * @ORM\GeneratedValue
  19. * @ORM\Column(type="integer")
  20. */
  21. private $id;
  22. /**
  23. * @ORM\ManyToOne(targetEntity=Contact::class, inversedBy="candidatures",cascade={"persist"})
  24. * @ORM\JoinColumn(nullable=false)
  25. */
  26. private $contact;
  27. /**
  28. * @ORM\Column(type="datetime")
  29. */
  30. private $sendDate;
  31. /**
  32. * @ORM\OneToMany(targetEntity=Media::class, mappedBy="candidature")
  33. */
  34. private $medias;
  35. /**
  36. * @ORM\Column(type="date")
  37. */
  38. private $availableFrom;
  39. /**
  40. * @ORM\Column(type="date")
  41. */
  42. private $availableTo;
  43. /**
  44. * @ORM\ManyToOne(targetEntity=Job::class, inversedBy="candidatures")
  45. */
  46. private $jobPosition;
  47. /**
  48. * @ORM\Column(type="text", nullable=true)
  49. */
  50. private $comments;
  51. /**
  52. * @ORM\ManyToOne(targetEntity=Saison::class)
  53. * @ORM\JoinColumn(nullable=false)
  54. */
  55. private $saison;
  56. /**
  57. * @ORM\Column(type="string", length=255, nullable=true)
  58. */
  59. private $statut;
  60. /**
  61. * @ORM\Column(type="boolean", nullable=true)
  62. */
  63. private $isActive;
  64. /**
  65. * @ORM\Column(type="boolean", nullable=false)
  66. */
  67. private $isCoupDeCoeur;
  68. /**
  69. * @ORM\Column(type="integer", nullable=true)
  70. */
  71. private $legacyId;
  72. /**
  73. * @ORM\Column(type="datetime")
  74. */
  75. private $updatedDate;
  76. /**
  77. * @ORM\PrePersist
  78. */
  79. public function updateValueCreate(): void
  80. {
  81. $this->updatedDate = new \DateTime();
  82. }
  83. /**
  84. * @ORM\PreUpdate
  85. */
  86. public function updateValueChange(): void
  87. {
  88. $this->updatedDate = new \DateTime();
  89. }
  90. public function __construct()
  91. {
  92. $this->medias = new ArrayCollection();
  93. }
  94. public function getId(): ?int
  95. {
  96. return $this->id;
  97. }
  98. public function getContact(): ?Contact
  99. {
  100. return $this->contact;
  101. }
  102. public function setContact(?Contact $contact): self
  103. {
  104. $this->contact = $contact;
  105. return $this;
  106. }
  107. public function getSendDate(): ?\DateTimeInterface
  108. {
  109. return $this->sendDate;
  110. }
  111. public function setSendDate(\DateTimeInterface $sendDate): self
  112. {
  113. $this->sendDate = $sendDate;
  114. return $this;
  115. }
  116. /**
  117. * @return Collection|Media[]
  118. */
  119. public function getMedias(): Collection
  120. {
  121. return $this->medias;
  122. }
  123. public function addMedia(Media $media): self
  124. {
  125. if (!$this->medias->contains($media)) {
  126. $this->medias[] = $media;
  127. $media->setCandidature($this);
  128. }
  129. return $this;
  130. }
  131. public function removeMedia(Media $media): self
  132. {
  133. if ($this->medias->removeElement($media)) {
  134. // set the owning side to null (unless already changed)
  135. if ($media->getCandidature() === $this) {
  136. $media->setCandidature(null);
  137. }
  138. }
  139. return $this;
  140. }
  141. public function getAvailableFrom(): ?\DateTimeInterface
  142. {
  143. return $this->availableFrom;
  144. }
  145. public function setAvailableFrom(\DateTimeInterface $availableFrom): self
  146. {
  147. $this->availableFrom = $availableFrom;
  148. return $this;
  149. }
  150. public function getAvailableTo(): ?\DateTimeInterface
  151. {
  152. return $this->availableTo;
  153. }
  154. public function setAvailableTo(\DateTimeInterface $availableTo): self
  155. {
  156. $this->availableTo = $availableTo;
  157. return $this;
  158. }
  159. public function getJobPosition(): ?Job
  160. {
  161. return $this->jobPosition;
  162. }
  163. public function setJobPosition(?Job $jobPosition): self
  164. {
  165. $this->jobPosition = $jobPosition;
  166. return $this;
  167. }
  168. public function getComments(): ?string
  169. {
  170. return $this->comments;
  171. }
  172. public function setComments(?string $comments): self
  173. {
  174. $this->comments = $comments;
  175. return $this;
  176. }
  177. public function getSaison(): ?Saison
  178. {
  179. return $this->saison;
  180. }
  181. public function setSaison(?Saison $saison): self
  182. {
  183. $this->saison = $saison;
  184. return $this;
  185. }
  186. public function isAffectation(): ?bool
  187. {
  188. return $this->saison !== null;
  189. }
  190. public function getStatut(): ?string
  191. {
  192. return $this->statut;
  193. }
  194. public function setStatut(?string $statut): self
  195. {
  196. $this->statut = $statut;
  197. return $this;
  198. }
  199. public function getIsActive(): ?bool
  200. {
  201. return $this->isActive;
  202. }
  203. public function setIsActive(?bool $isActive): self
  204. {
  205. $this->isActive = $isActive;
  206. return $this;
  207. }
  208. public function getIsCoupDeCoeur(): ?bool
  209. {
  210. return $this->isCoupDeCoeur;
  211. }
  212. public function setIsCoupDeCoeur(?bool $isCoupDeCoeur): self
  213. {
  214. $this->isCoupDeCoeur = $isCoupDeCoeur;
  215. return $this;
  216. }
  217. public function getLegacyId(): ?int
  218. {
  219. return $this->legacyId;
  220. }
  221. public function setLegacyId(?int $legacyId): self
  222. {
  223. $this->legacyId = $legacyId;
  224. return $this;
  225. }
  226. public function getUpdatedDate(): ?\DateTimeInterface
  227. {
  228. return $this->updatedDate;
  229. }
  230. public function setUpdatedDate(\DateTimeInterface $updatedDate): self
  231. {
  232. $this->updatedDate = $updatedDate;
  233. return $this;
  234. }
  235. }