src/Entity/OffreEmploi.php line 155

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * Copyright (C) Office National de Publication et de Communication - All Rights Reserved
  5.  *
  6.  * Unauthorized copying of this file, via any medium is strictly prohibited by law
  7.  * This file is proprietary and confidential
  8.  */
  9. namespace App\Entity;
  10. use App\Entity\Common\IdTrait;
  11. use DateTime;
  12. use Doctrine\Common\Collections\ArrayCollection;
  13. use Doctrine\Common\Collections\Collection;
  14. use Doctrine\ORM\Mapping as ORM;
  15. use Symfony\Component\Validator\Constraints as Assert;
  16. /**
  17.  * @ORM\Entity(repositoryClass="App\Repository\OffreEmploiRepository")
  18.  * @ORM\Table(
  19.  *     name="offre_emploi",
  20.  *     indexes={
  21.  *         @ORM\Index(columns={"date_creation"})
  22.  *     }
  23.  * )
  24.  */
  25. class OffreEmploi
  26. {
  27.     use IdTrait;
  28.     /** @ORM\Column(type="string", nullable=true) */
  29.     private $idDistant;
  30.     /** @ORM\Column(type="datetime", nullable=false) */
  31.     private $dateCreation;
  32.     /** @ORM\Column(type="datetime", nullable=false) */
  33.     private $dateActualisation;
  34.     /** @ORM\Column(type="datetime", nullable=true) */
  35.     private $dateValidite;
  36.     /** @ORM\Column(type="string", nullable=true) */
  37.     private $libelle// ce champ n'est plus utilisé, remplace par "profil"
  38.     /** @ORM\Column(type="text", nullable=true) */
  39.     private $description;
  40.     /**
  41.      * @Assert\Url(protocols={"https"})
  42.      * @ORM\Column(type="string", nullable=true)
  43.      */
  44.     private $url;
  45.     /**
  46.      * @Assert\Url
  47.      * @ORM\Column(type="string", nullable=true)
  48.      */
  49.     private $urlImage;
  50.     /** @ORM\Column(type="text", nullable=true) */
  51.     private $jsonLd;
  52.     /**
  53.      * @ORM\ManyToOne(targetEntity="Etablissement", inversedBy="offresEmploi")
  54.      * @ORM\JoinColumn(nullable=false)
  55.      */
  56.     private $etablissement;
  57.     /**
  58.      * @ORM\OneToMany(targetEntity="OffreEmploiCandidature", mappedBy="offreEmploi", cascade={"persist"}, fetch="EXTRA_LAZY")
  59.      */
  60.     private $candidatures;
  61.     /**
  62.      * @ORM\ManyToOne(targetEntity="App\Entity\OffreEmploiProfil", inversedBy="offreEmplois")
  63.      */
  64.     private $profil;
  65.     /**
  66.      * @ORM\ManyToOne(targetEntity="App\Entity\OffreEmploiContrat", inversedBy="offreEmplois")
  67.      */
  68.     private $contrat;
  69.     public function __construct()
  70.     {
  71.         $this->candidatures = new ArrayCollection();
  72.     }
  73.     public function setIdDistant(string $idDistant): void
  74.     {
  75.         $this->idDistant $idDistant;
  76.     }
  77.     public function getIdDistant(): ?string
  78.     {
  79.         return $this->idDistant;
  80.     }
  81.     public function setDateCreation(DateTime $date): void
  82.     {
  83.         $this->dateCreation $date;
  84.     }
  85.     public function getDateCreation(): DateTime
  86.     {
  87.         return $this->dateCreation;
  88.     }
  89.     public function setDateActualisation(DateTime $date): void
  90.     {
  91.         $this->dateActualisation $date;
  92.     }
  93.     public function getDateActualisation(): DateTime
  94.     {
  95.         return $this->dateActualisation;
  96.     }
  97.     public function setDateValidite(?DateTime $date): void
  98.     {
  99.         $this->dateValidite $date;
  100.     }
  101.     public function getDateValidite(): ?DateTime
  102.     {
  103.         return $this->dateValidite;
  104.     }
  105.     public function isValid(): bool
  106.     {
  107.         return !$this->dateValidite || $this->dateValidite >= new DateTime();
  108.     }
  109.     public function setLibelle(string $libelle): void
  110.     {
  111.         // $this->libelle = $libelle;
  112.         // $this->libelle = $this->getProfil()->getLibelle();
  113.         // Résoudre le pb d'importation des anciennes offres
  114.         $this->libelle $this->getProfil()->getId() == 999 $libelle $this->getProfil()->getLibelle();
  115.     }
  116.     public function getLibelle(): ?string
  117.     {
  118.         // return $this->libelle;
  119.         // return $this->getProfil()->getLibelle();
  120.         // Résoudre le pb d'importation des anciennes offres
  121.         return $this->getProfil()->getId() == 999 $this->libelle $this->getProfil()->getLibelle();
  122.     }
  123.     public function setDescription(?string $description): void
  124.     {
  125.         $this->description $description;
  126.     }
  127.     public function getDescription(): ?string
  128.     {
  129.         return $this->description;
  130.     }
  131.     public function setUrl(?string $url): void
  132.     {
  133.         $this->url $url;
  134.     }
  135.     public function getUrl()
  136.     {
  137.         return $this->url;
  138.     }
  139.     public function setUrlImage(?string $urlImage): void
  140.     {
  141.         $this->urlImage $urlImage;
  142.     }
  143.     public function getUrlImage(): ?string
  144.     {
  145.         return $this->urlImage;
  146.     }
  147.     public function setJsonLd(?string $jsonLd): void
  148.     {
  149.         $this->jsonLd $jsonLd;
  150.     }
  151.     public function getJsonLd(): ?string
  152.     {
  153.         return $this->jsonLd;
  154.     }
  155.     public function setEtablissement(Etablissement $etablissement): void
  156.     {
  157.         $this->etablissement $etablissement;
  158.     }
  159.     public function getEtablissement(): ?Etablissement
  160.     {
  161.         return $this->etablissement;
  162.     }
  163.     public function addCandidature(OffreEmploiCandidature $candidatures): void
  164.     {
  165.         $this->candidatures[] = $candidatures;
  166.     }
  167.     public function removeCandidature(OffreEmploiCandidature $candidatures): void
  168.     {
  169.         $this->candidatures->removeElement($candidatures);
  170.     }
  171.     public function getCandidature(): Collection
  172.     {
  173.         return $this->candidatures;
  174.     }
  175.     public function getProfil(): ?OffreEmploiProfil
  176.     {
  177.         return $this->profil;
  178.     }
  179.     public function setProfil(?OffreEmploiProfil $profil): self
  180.     {
  181.         $this->profil $profil;
  182.         return $this;
  183.     }
  184.     public function getContrat(): ?OffreEmploiContrat
  185.     {
  186.         return $this->contrat;
  187.     }
  188.     public function setContrat(?OffreEmploiContrat $contrat): self
  189.     {
  190.         $this->contrat $contrat;
  191.         return $this;
  192.     }
  193. }