src/Entity/Contact.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ContactRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  11. use Symfony\Component\Serializer\Annotation\Ignore;
  12. /**
  13. * @ORM\Entity(repositoryClass=ContactRepository::class)
  14. * @Vich\Uploadable
  15. * @UniqueEntity(fields="email", message="Il existe déjà un utilisateur avec cet email")
  16. */
  17. class Contact
  18. {
  19. const TYPE_CANDIDAT = "candidat";
  20. const TYPE_EMPLOYE = "employé";
  21. const TYPE_ENFANT = "enfant";
  22. /**
  23. * @ORM\Id
  24. * @ORM\GeneratedValue
  25. * @ORM\Column(type="integer")
  26. */
  27. private $id;
  28. /**
  29. * @ORM\Column(type="string", length=50, nullable=true)
  30. */
  31. private $firstName;
  32. /**
  33. * @ORM\Column(type="string", length=50, nullable=true)
  34. */
  35. private $lastName;
  36. /**
  37. * @Ignore()
  38. * @ORM\Column(type="string", length=255, nullable=true)
  39. */
  40. private $img;
  41. /**
  42. * @Ignore()
  43. * @Vich\UploadableField(mapping="contact_image", fileNameProperty="img")
  44. *
  45. * @var File|null
  46. *
  47. */
  48. private ?File $imgFile = null;
  49. /**
  50. * @ORM\OneToOne(targetEntity=User::class, mappedBy="contact", cascade={"persist", "remove"})
  51. */
  52. private $user;
  53. /**
  54. * @ORM\Column(type="json")
  55. */
  56. private $type = [];
  57. /**
  58. * @ORM\OneToMany(targetEntity=ContactPropertyValue::class, mappedBy="contact",cascade={"persist","remove"})
  59. */
  60. private $contactPropertyValues;
  61. /**
  62. * @ORM\Column(type="string", length=1, nullable=true)
  63. */
  64. private $sexe;
  65. /**
  66. * @ORM\Column(type="boolean",options={"default": false})
  67. */
  68. private $droitIlmg;
  69. /**
  70. * @ORM\ManyToOne(targetEntity=Location::class, inversedBy="contacts",cascade={"persist"})
  71. */
  72. private $location;
  73. /**
  74. * @ORM\OneToMany(targetEntity=Inscription::class, mappedBy="enfant",cascade={"remove"})
  75. */
  76. private $inscriptions;
  77. /**
  78. * @ORM\Column(type="date", nullable=true)
  79. */
  80. private $birthDate;
  81. /**
  82. * @ORM\OneToMany(targetEntity=Inscription::class, mappedBy="parent",cascade={"remove"})
  83. */
  84. private $inscriptionParents;
  85. /**
  86. * @ORM\OneToMany(targetEntity=Equipier::class, mappedBy="contact")
  87. */
  88. private $equipiers;
  89. /**
  90. * @ORM\OneToMany(targetEntity=SejourSessionEquipier::class, mappedBy="contact")
  91. */
  92. private $sejourSessionEquipiers;
  93. /**
  94. * @ORM\Column(type="string", length=255, nullable=true, unique=true)
  95. * @Assert\Email
  96. */
  97. private $email;
  98. /**
  99. * @ORM\ManyToOne(targetEntity=Contact::class, inversedBy="children")
  100. */
  101. private $parent;
  102. /**
  103. * @ORM\OneToMany(targetEntity=Contact::class, mappedBy="parent")
  104. */
  105. private $children;
  106. /**
  107. * @ORM\OneToMany(targetEntity=Candidature::class, mappedBy="contact")
  108. */
  109. private $candidatures;
  110. /**
  111. * @ORM\OneToMany(targetEntity=Compta::class, mappedBy="contact")
  112. */
  113. private $comptas;
  114. /**
  115. * @ORM\OneToMany(targetEntity=Media::class, mappedBy="contact",cascade={"persist","remove"})
  116. */
  117. private $medias;
  118. /**
  119. * @ORM\Column(type="string", length=255, nullable=true)
  120. */
  121. private $legacyId;
  122. /**
  123. * @ORM\OneToOne(targetEntity=Enterprise::class, mappedBy="contact", cascade={"persist", "remove"})
  124. */
  125. private $enterprise;
  126. /**
  127. * @ORM\OneToMany(targetEntity=ContactComment::class, mappedBy="contact")
  128. * @ORM\OrderBy({"createdDate" = "DESC"})
  129. *
  130. */
  131. private $contactComments;
  132. /**
  133. * @ORM\OneToMany(targetEntity=DemandeSejourCorse::class, mappedBy="contact")
  134. */
  135. private $demandeSejourCorses;
  136. /**
  137. * @ORM\Column(type="string", length=255, nullable=true)
  138. */
  139. private $legacyPrefix;
  140. /**
  141. * @ORM\OneToMany(targetEntity=LegacyEmploye::class, mappedBy="contact")
  142. */
  143. private $legacyEmployes;
  144. /**
  145. * @ORM\Column(type="integer", nullable=true)
  146. */
  147. private $legacyProfessionelId;
  148. /**
  149. * @ORM\OneToMany(targetEntity=EmployeeContract::class, mappedBy="contact")
  150. */
  151. private $employeeContracts;
  152. /**
  153. * @ORM\OneToMany(targetEntity=ReductionRequest::class, mappedBy="contact")
  154. */
  155. private $reductionRequests;
  156. /**
  157. * @ORM\Column(type="datetime", nullable=true)
  158. */
  159. private $updatedAt;
  160. /**
  161. * @ORM\OneToMany(targetEntity=TiersDeConfiance::class, mappedBy="main")
  162. */
  163. private $tiersDeConfiances;
  164. /**
  165. * @ORM\OneToMany(targetEntity=TiersDeConfiance::class, mappedBy="tiers")
  166. */
  167. private $tiersDeConfianceRelations;
  168. public function __construct()
  169. {
  170. $this->contactPropertyValues = new ArrayCollection();
  171. $this->inscriptions = new ArrayCollection();
  172. $this->inscriptionParents = new ArrayCollection();
  173. $this->equipiers = new ArrayCollection();
  174. $this->sejourSessionEquipiers = new ArrayCollection();
  175. $this->children = new ArrayCollection();
  176. $this->candidatures = new ArrayCollection();
  177. $this->comptas = new ArrayCollection();
  178. $this->medias = new ArrayCollection();
  179. $this->contactComments = new ArrayCollection();
  180. $this->demandeSejourCorses = new ArrayCollection();
  181. $this->legacyEmployes = new ArrayCollection();
  182. $this->employeeContracts = new ArrayCollection();
  183. $this->reductionRequests = new ArrayCollection();
  184. $this->tiersDeConfiances = new ArrayCollection();
  185. $this->tiersDeConfianceRelations = new ArrayCollection();
  186. $this->droitIlmg = false;
  187. }
  188. public function getOrderSejourSessionEquipiers(){
  189. $sejourSessionEquipiers = $this->getSejourSessionEquipiers();
  190. $output = [];
  191. foreach($sejourSessionEquipiers as $sse){
  192. $output[$sse->getSejourSession()->getDateDebut()->format('Ymd').$sse->getId()] = $sse;
  193. }
  194. return $output;
  195. }
  196. public function getId(): ?int
  197. {
  198. return $this->id;
  199. }
  200. public function getFirstName(): ?string
  201. {
  202. return $this->firstName;
  203. }
  204. public function setFirstName(string $firstName): self
  205. {
  206. $this->firstName = $firstName;
  207. return $this;
  208. }
  209. public function getLastName(): ?string
  210. {
  211. return $this->lastName;
  212. }
  213. public function setLastName(?string $lastName): self
  214. {
  215. $this->lastName = strtoupper($lastName);
  216. return $this;
  217. }
  218. public function getImg(): ?string
  219. {
  220. return $this->img;
  221. }
  222. public function setImg(?string $img): self
  223. {
  224. $this->img = $img;
  225. return $this;
  226. }
  227. /**
  228. * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  229. * of 'UploadedFile' is injected into this setter to trigger the update. If this
  230. * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  231. * must be able to accept an instance of 'File' as the bundle will inject one here
  232. * during Doctrine hydration.
  233. *
  234. * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile
  235. */
  236. public function setImgFile(?File $imageFile = null): void
  237. {
  238. $this->imgFile = $imageFile;
  239. if ($imageFile) {
  240. $this->SetImg($imageFile->getFilename());
  241. // if 'updatedAt' is not defined in your entity, use another property
  242. $this->updatedDate = new \DateTime('now');
  243. }
  244. }
  245. public function getImgFile(): ?File
  246. {
  247. return $this->imgFile;
  248. }
  249. public function getUser(): ?User
  250. {
  251. return $this->user;
  252. }
  253. public function setUser(User $user): self
  254. {
  255. // set the owning side of the relation if necessary
  256. if ($user->getContact() !== $this) {
  257. $user->setContact($this);
  258. }
  259. $this->user = $user;
  260. return $this;
  261. }
  262. public function getType(): ?array
  263. {
  264. return $this->type;
  265. }
  266. public function setType(array $type): self
  267. {
  268. $this->type = $type;
  269. return $this;
  270. }
  271. /**
  272. * @return Collection|ContactPropertyValue[]
  273. */
  274. public function getContactPropertyValues(): Collection
  275. {
  276. return $this->contactPropertyValues;
  277. }
  278. /**
  279. * @return Collection|ContactPropertyValue[]
  280. */
  281. public function getOrderedContactPropertyValues(): array
  282. {
  283. $cpvs = $this->getContactPropertyValues();
  284. $output1 = ['Informations générales' => [],
  285. 'Mensurations' => [],
  286. 'Santé' => [],
  287. 'Contacts' => [],
  288. ];
  289. foreach ($cpvs as $cpv) {
  290. $output1[$cpv->getProperty()->getSubType()][] = $cpv;
  291. }
  292. foreach($output1 as $key => $value){
  293. if(count($value)==0){
  294. unset($output1[$key]);
  295. }
  296. }
  297. foreach($output1 as $key => $value){
  298. usort($value, function($a, $b) {
  299. return $a->getProperty()->getPosition() > $b->getProperty()->getPosition();
  300. });
  301. $output1[$key] = $value;
  302. }
  303. return $output1;
  304. }
  305. public function addContactPropertyValue(ContactPropertyValue $contactPropertyValue): self
  306. {
  307. if (!$this->contactPropertyValues->contains($contactPropertyValue)) {
  308. $this->contactPropertyValues[] = $contactPropertyValue;
  309. $contactPropertyValue->setContact($this);
  310. }
  311. return $this;
  312. }
  313. public function removeContactPropertyValue(ContactPropertyValue $contactPropertyValue): self
  314. {
  315. if ($this->contactPropertyValues->removeElement($contactPropertyValue)) {
  316. // set the owning side to null (unless already changed)
  317. if ($contactPropertyValue->getContact() === $this) {
  318. $contactPropertyValue->setContact(null);
  319. }
  320. }
  321. return $this;
  322. }
  323. public function getSexe(): ?string
  324. {
  325. return $this->sexe;
  326. }
  327. public function setSexe(?string $Sexe): self
  328. {
  329. $this->sexe = $Sexe;
  330. return $this;
  331. }
  332. public function getLocation(): ?Location
  333. {
  334. return $this->location;
  335. }
  336. public function setLocation(?Location $location): self
  337. {
  338. $this->location = $location;
  339. return $this;
  340. }
  341. /**
  342. * @return Collection|Inscription[]
  343. */
  344. public function getInscriptions(): Collection
  345. {
  346. return $this->inscriptions;
  347. }
  348. public function addInscription(Inscription $inscription): self
  349. {
  350. if (!$this->inscriptions->contains($inscription)) {
  351. $this->inscriptions[] = $inscription;
  352. $inscription->setEnfant($this);
  353. }
  354. return $this;
  355. }
  356. public function removeInscription(Inscription $inscription): self
  357. {
  358. if ($this->inscriptions->removeElement($inscription)) {
  359. // set the owning side to null (unless already changed)
  360. if ($inscription->getEnfant() === $this) {
  361. $inscription->setEnfant(null);
  362. }
  363. }
  364. return $this;
  365. }
  366. public function getBirthDate(): ?\DateTimeInterface
  367. {
  368. return $this->birthDate;
  369. }
  370. public function setBirthDate(?\DateTimeInterface $birthDate): self
  371. {
  372. $this->birthDate = $birthDate;
  373. return $this;
  374. }
  375. /**
  376. * @return Collection|Inscription[]
  377. */
  378. public function getInscriptionParents(): Collection
  379. {
  380. return $this->inscriptionParents;
  381. }
  382. public function addInscriptionParent(Inscription $inscriptionParent): self
  383. {
  384. if (!$this->inscriptionParents->contains($inscriptionParent)) {
  385. $this->inscriptionParents[] = $inscriptionParent;
  386. $inscriptionParent->setParent($this);
  387. }
  388. return $this;
  389. }
  390. public function removeInscriptionParent(Inscription $inscriptionParent): self
  391. {
  392. if ($this->inscriptionParents->removeElement($inscriptionParent)) {
  393. // set the owning side to null (unless already changed)
  394. if ($inscriptionParent->getParent() === $this) {
  395. $inscriptionParent->setParent(null);
  396. }
  397. }
  398. return $this;
  399. }
  400. /**
  401. * @return Collection|Equipier[]
  402. */
  403. public function getEquipiers(): Collection
  404. {
  405. return $this->equipiers;
  406. }
  407. public function addEquipier(Equipier $equipier): self
  408. {
  409. if (!$this->equipiers->contains($equipier)) {
  410. $this->equipiers[] = $equipier;
  411. $equipier->setContact($this);
  412. }
  413. return $this;
  414. }
  415. public function removeEquipier(Equipier $equipier): self
  416. {
  417. if ($this->equipiers->removeElement($equipier)) {
  418. // set the owning side to null (unless already changed)
  419. if ($equipier->getContact() === $this) {
  420. $equipier->setContact(null);
  421. }
  422. }
  423. return $this;
  424. }
  425. /**
  426. * @return Collection|SejourSessionEquipier[]
  427. */
  428. public function getSejourSessionEquipiers(): Collection
  429. {
  430. return $this->sejourSessionEquipiers;
  431. }
  432. public function addSejourSessionEquipier(SejourSessionEquipier $sejourSessionEquipier): self
  433. {
  434. if (!$this->sejourSessionEquipiers->contains($sejourSessionEquipier)) {
  435. $this->sejourSessionEquipiers[] = $sejourSessionEquipier;
  436. $sejourSessionEquipier->setContact($this);
  437. }
  438. return $this;
  439. }
  440. public function removeSejourSessionEquipier(SejourSessionEquipier $sejourSessionEquipier): self
  441. {
  442. if ($this->sejourSessionEquipiers->removeElement($sejourSessionEquipier)) {
  443. // set the owning side to null (unless already changed)
  444. if ($sejourSessionEquipier->getContact() === $this) {
  445. $sejourSessionEquipier->setContact(null);
  446. }
  447. }
  448. return $this;
  449. }
  450. public function getEmail(): ?string
  451. {
  452. return $this->email;
  453. }
  454. public function setEmail(?string $email): self
  455. {
  456. $this->email = $email;
  457. return $this;
  458. }
  459. public function getParent(): ?self
  460. {
  461. return $this->parent;
  462. }
  463. public function setParent(?self $parent): self
  464. {
  465. $this->parent = $parent;
  466. return $this;
  467. }
  468. public function getDroitIlmg(): bool
  469. {
  470. return $this->droitIlmg;
  471. }
  472. public function setDroitIlmg(bool $droitIlmg): self
  473. {
  474. $this->droitIlmg = $droitIlmg;
  475. return $this;
  476. }
  477. /**
  478. * @return Collection|self[]
  479. */
  480. public function getChildren(): Collection
  481. {
  482. return $this->children;
  483. }
  484. public function addChild(self $child): self
  485. {
  486. if (!$this->children->contains($child)) {
  487. $this->children[] = $child;
  488. $child->setParent($this);
  489. }
  490. return $this;
  491. }
  492. public function removeChild(self $child): self
  493. {
  494. if ($this->children->removeElement($child)) {
  495. // set the owning side to null (unless already changed)
  496. if ($child->getParent() === $this) {
  497. $child->setParent(null);
  498. }
  499. }
  500. return $this;
  501. }
  502. /**
  503. * @return Collection|Candidature[]
  504. */
  505. public function getCandidatures(): Collection
  506. {
  507. return $this->candidatures;
  508. }
  509. public function addCandidature(Candidature $candidature): self
  510. {
  511. if (!$this->candidatures->contains($candidature)) {
  512. $this->candidatures[] = $candidature;
  513. $candidature->setContact($this);
  514. }
  515. return $this;
  516. }
  517. public function removeCandidature(Candidature $candidature): self
  518. {
  519. if ($this->candidatures->removeElement($candidature)) {
  520. // set the owning side to null (unless already changed)
  521. if ($candidature->getContact() === $this) {
  522. $candidature->setContact(null);
  523. }
  524. }
  525. return $this;
  526. }
  527. /**
  528. * @return Collection|Compta[]
  529. */
  530. public function getComptas(): Collection
  531. {
  532. return $this->comptas;
  533. }
  534. public function addCompta(Compta $compta): self
  535. {
  536. if (!$this->comptas->contains($compta)) {
  537. $this->comptas[] = $compta;
  538. $compta->setContact($this);
  539. }
  540. return $this;
  541. }
  542. public function removeCompta(Compta $compta): self
  543. {
  544. if ($this->comptas->removeElement($compta)) {
  545. // set the owning side to null (unless already changed)
  546. if ($compta->getContact() === $this) {
  547. $compta->setContact(null);
  548. }
  549. }
  550. return $this;
  551. }
  552. /**
  553. * @return Collection|Media[]
  554. */
  555. public function getMedias(): Collection
  556. {
  557. return $this->medias;
  558. }
  559. public function addMedia(Media $media): self
  560. {
  561. if (!$this->medias->contains($media)) {
  562. $this->medias[] = $media;
  563. $media->setContact($this);
  564. }
  565. return $this;
  566. }
  567. public function removeMedia(Media $media): self
  568. {
  569. if ($this->medias->removeElement($media)) {
  570. // set the owning side to null (unless already changed)
  571. if ($media->getContact() === $this) {
  572. $media->setContact(null);
  573. }
  574. }
  575. return $this;
  576. }
  577. public function getLegacyId(): ?string
  578. {
  579. return $this->legacyId;
  580. }
  581. public function setLegacyId(?string $legacyId): self
  582. {
  583. $this->legacyId = $legacyId;
  584. return $this;
  585. }
  586. public function getEnterprise(): ?Enterprise
  587. {
  588. return $this->enterprise;
  589. }
  590. public function setEnterprise(Enterprise $enterprise): self
  591. {
  592. // set the owning side of the relation if necessary
  593. if ($enterprise->getContact() !== $this) {
  594. $enterprise->setContact($this);
  595. }
  596. $this->enterprise = $enterprise;
  597. return $this;
  598. }
  599. /**
  600. * @return Collection|ContactComment[]
  601. */
  602. public function getContactComments(): Collection
  603. {
  604. return $this->contactComments;
  605. }
  606. public function addContactComment(ContactComment $contactComment): self
  607. {
  608. if (!$this->contactComments->contains($contactComment)) {
  609. $this->contactComments[] = $contactComment;
  610. $contactComment->setContact($this);
  611. }
  612. return $this;
  613. }
  614. public function removeContactComment(ContactComment $contactComment): self
  615. {
  616. if ($this->contactComments->removeElement($contactComment)) {
  617. // set the owning side to null (unless already changed)
  618. if ($contactComment->getContact() === $this) {
  619. $contactComment->setContact(null);
  620. }
  621. }
  622. return $this;
  623. }
  624. /**
  625. * @return Collection|DemandeSejourCorse[]
  626. */
  627. public function getDemandeSejourCorses(): Collection
  628. {
  629. return $this->demandeSejourCorses;
  630. }
  631. public function addDemandeSejourCorse(DemandeSejourCorse $demandeSejourCorse): self
  632. {
  633. if (!$this->demandeSejourCorses->contains($demandeSejourCorse)) {
  634. $this->demandeSejourCorses[] = $demandeSejourCorse;
  635. $demandeSejourCorse->setContact($this);
  636. }
  637. return $this;
  638. }
  639. public function removeDemandeSejourCorse(DemandeSejourCorse $demandeSejourCorse): self
  640. {
  641. if ($this->demandeSejourCorses->removeElement($demandeSejourCorse)) {
  642. // set the owning side to null (unless already changed)
  643. if ($demandeSejourCorse->getContact() === $this) {
  644. $demandeSejourCorse->setContact(null);
  645. }
  646. }
  647. return $this;
  648. }
  649. public function getLegacyPrefix(): ?string
  650. {
  651. return $this->legacyPrefix;
  652. }
  653. public function setLegacyPrefix(?string $legacyPrefix): self
  654. {
  655. $this->legacyPrefix = $legacyPrefix;
  656. return $this;
  657. }
  658. /**
  659. * @return Collection|LegacyEmploye[]
  660. */
  661. public function getLegacyEmployes(): Collection
  662. {
  663. return $this->legacyEmployes;
  664. }
  665. public function addLegacyEmploye(LegacyEmploye $legacyEmploye): self
  666. {
  667. if (!$this->legacyEmployes->contains($legacyEmploye)) {
  668. $this->legacyEmployes[] = $legacyEmploye;
  669. $legacyEmploye->setContact($this);
  670. }
  671. return $this;
  672. }
  673. public function removeLegacyEmploye(LegacyEmploye $legacyEmploye): self
  674. {
  675. if ($this->legacyEmployes->removeElement($legacyEmploye)) {
  676. // set the owning side to null (unless already changed)
  677. if ($legacyEmploye->getContact() === $this) {
  678. $legacyEmploye->setContact(null);
  679. }
  680. }
  681. return $this;
  682. }
  683. public function getLegacyProfessionelId(): ?int
  684. {
  685. return $this->legacyProfessionelId;
  686. }
  687. public function setLegacyProfessionelId(?int $legacyProfessionelId): self
  688. {
  689. $this->legacyProfessionelId = $legacyProfessionelId;
  690. return $this;
  691. }
  692. /**
  693. * @return Collection|EmployeeContract[]
  694. */
  695. public function getEmployeeContracts(): Collection
  696. {
  697. return $this->employeeContracts;
  698. }
  699. public function addEmployeeContract(EmployeeContract $employeeContract): self
  700. {
  701. if (!$this->employeeContracts->contains($employeeContract)) {
  702. $this->employeeContracts[] = $employeeContract;
  703. $employeeContract->setContact($this);
  704. }
  705. return $this;
  706. }
  707. public function removeEmployeeContract(EmployeeContract $employeeContract): self
  708. {
  709. if ($this->employeeContracts->removeElement($employeeContract)) {
  710. // set the owning side to null (unless already changed)
  711. if ($employeeContract->getContact() === $this) {
  712. $employeeContract->setContact(null);
  713. }
  714. }
  715. return $this;
  716. }
  717. public function getAge(): int
  718. {
  719. $bdate = $this->birthDate;
  720. return date_diff($bdate, date_create('now'))->y;
  721. }
  722. // public function getAgeComplete(): int
  723. // {
  724. // $bdate = date_create_from_format('Y-m-d', $this->birthDate->format('Y') . '-01-01');
  725. // return date_diff($bdate, date_create('now'))->y;
  726. // }
  727. public function getAgeComplete($debutSejour = null): ?int
  728. {
  729. if ($debutSejour === null) {
  730. $debutSejour = new DateTime();
  731. }
  732. $bdate = date_create_from_format('Y-m-d', $this->birthDate->format('Y') . '-01-01');
  733. //$bdate = $this->birthDate;
  734. return date_diff($bdate, $debutSejour)->y;
  735. }
  736. /**
  737. * @return Collection|ReductionRequest[]
  738. */
  739. public function getReductionRequests(): Collection
  740. {
  741. return $this->reductionRequests;
  742. }
  743. public function addReductionRequest(ReductionRequest $reductionRequest): self
  744. {
  745. if (!$this->reductionRequests->contains($reductionRequest)) {
  746. $this->reductionRequests[] = $reductionRequest;
  747. $reductionRequest->setContact($this);
  748. }
  749. return $this;
  750. }
  751. public function removeReductionRequest(ReductionRequest $reductionRequest): self
  752. {
  753. if ($this->reductionRequests->removeElement($reductionRequest)) {
  754. // set the owning side to null (unless already changed)
  755. if ($reductionRequest->getContact() === $this) {
  756. $reductionRequest->setContact(null);
  757. }
  758. }
  759. return $this;
  760. }
  761. public function getUpdatedAt(): ?\DateTimeInterface
  762. {
  763. return $this->updatedAt;
  764. }
  765. public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  766. {
  767. $this->updatedAt = $updatedAt;
  768. return $this;
  769. }
  770. /**
  771. * @return Collection<int, TiersDeConfiance>
  772. */
  773. public function getTiersDeConfiances(): Collection
  774. {
  775. return $this->tiersDeConfiances;
  776. }
  777. public function addTiersDeConfiance(TiersDeConfiance $tiersDeConfiance): self
  778. {
  779. if (!$this->tiersDeConfiances->contains($tiersDeConfiance)) {
  780. $this->tiersDeConfiances[] = $tiersDeConfiance;
  781. $tiersDeConfiance->setMain($this);
  782. }
  783. return $this;
  784. }
  785. public function removeTiersDeConfiance(TiersDeConfiance $tiersDeConfiance): self
  786. {
  787. if ($this->tiersDeConfiances->removeElement($tiersDeConfiance)) {
  788. // set the owning side to null (unless already changed)
  789. if ($tiersDeConfiance->getMain() === $this) {
  790. $tiersDeConfiance->setMain(null);
  791. }
  792. }
  793. return $this;
  794. }
  795. /**
  796. * @return Collection<int, TiersDeConfiance>
  797. */
  798. public function getTiersDeConfianceRelations(): Collection
  799. {
  800. return $this->tiersDeConfianceRelations;
  801. }
  802. public function addTiersDeConfianceRelation(TiersDeConfiance $tiersDeConfianceRelation): self
  803. {
  804. if (!$this->tiersDeConfianceRelations->contains($tiersDeConfianceRelation)) {
  805. $this->tiersDeConfianceRelations[] = $tiersDeConfianceRelation;
  806. $tiersDeConfianceRelation->setTiers($this);
  807. }
  808. return $this;
  809. }
  810. public function removeTiersDeConfianceRelation(TiersDeConfiance $tiersDeConfianceRelation): self
  811. {
  812. if ($this->tiersDeConfianceRelations->removeElement($tiersDeConfianceRelation)) {
  813. // set the owning side to null (unless already changed)
  814. if ($tiersDeConfianceRelation->getTiers() === $this) {
  815. $tiersDeConfianceRelation->setTiers(null);
  816. }
  817. }
  818. return $this;
  819. }
  820. public function getSexeEcrit()
  821. {
  822. return $this->sexe == "F" ? "Madame" : "Monsieur";
  823. }
  824. }