src/Entity/FicheProspect.php line 24

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\AdresseTrait;
  11. use App\Entity\Common\IdTrait;
  12. use App\Validator\Constraints as AppAssert;
  13. use DateTime;
  14. use Doctrine\ORM\Mapping as ORM;
  15. use Symfony\Component\Validator\Constraints as Assert;
  16. /**
  17.  * @ORM\Entity(repositoryClass="App\Repository\FicheProspectRepository")
  18.  */
  19. class FicheProspect
  20. {
  21.     use AdresseTrait;
  22.     use IdTrait;
  23.     /** @ORM\Column(type="datetime", nullable=false) */
  24.     private $date;
  25.     /** @ORM\Column(type="string", nullable=false) 
  26.      * @Assert\Length(max=30)
  27.     */
  28.     private $nom;
  29.     /** @ORM\Column(type="string", nullable=false) 
  30.      * @Assert\Length(max=50)
  31.     */
  32.     private $adresse;
  33.     /**
  34.      * @ORM\Column(type="string", nullable=false)
  35.      * @Assert\Length(max=6)
  36.      */
  37.     private $codePostal;
  38.     /** @ORM\Column(type="string", nullable=false) 
  39.      * @Assert\Length(max=30)
  40.     */
  41.     private $ville;
  42.     /** @ORM\Column(type="string", nullable=false) 
  43.      *  @Assert\Length(max=10)
  44.     */
  45.     private $telephone;
  46.     /**
  47.      * @ORM\Column(type="string", length=150, nullable=false)
  48.      * @Assert\Email
  49.      */
  50.     private $email;
  51.     /**
  52.      * @ORM\Column(type="string", nullable=true)
  53.      * @Assert\Length(max=100)
  54.      * @Assert\Url
  55.      */
  56.     private $siteWeb;
  57.     /** @ORM\Column(type="string", nullable=true) 
  58.      * @Assert\Length(max=30)
  59.     */
  60.     private $responsable;
  61.     /**
  62.      * @ORM\Column(type="string", nullable=false)
  63.      * @Assert\Length(max=50)
  64.      * @Assert\NotBlank
  65.      */
  66.     private $categorie;
  67.     /**
  68.      * @ORM\Column(type="text", nullable=true)
  69.      * @Assert\Length(max=300)
  70.      * @AppAssert\DoesNotContainsLink
  71.      */
  72.     private $description;
  73.     /** @ORM\Column(type="boolean", nullable=false) */
  74.     private $autoriseContact;
  75.     /**
  76.      * @ORM\ManyToOne(targetEntity="Etablissement")
  77.      * @ORM\JoinColumn(name="etablissement_id", referencedColumnName="id", nullable=false)
  78.      */
  79.     private $etablissement;
  80.     public function __construct()
  81.     {
  82.         $this->date = new DateTime();
  83.     }
  84.     public function setNom(string $nom): void
  85.     {
  86.         $this->nom $nom;
  87.     }
  88.     public function getNom(): ?string
  89.     {
  90.         return $this->nom;
  91.     }
  92.     public function setTelephone(string $telephone): void
  93.     {
  94.         $this->telephone $telephone;
  95.     }
  96.     public function getTelephone(): ?string
  97.     {
  98.         return $this->telephone;
  99.     }
  100.     public function setEmail(string $email): void
  101.     {
  102.         $this->email $email;
  103.     }
  104.     public function getEmail(): ?string
  105.     {
  106.         return $this->email;
  107.     }
  108.     public function setSiteWeb(string $siteWeb): void
  109.     {
  110.         $this->siteWeb $siteWeb;
  111.     }
  112.     public function getSiteWeb(): ?string
  113.     {
  114.         return $this->siteWeb;
  115.     }
  116.     public function setResponsable(string $responsable): void
  117.     {
  118.         $this->responsable $responsable;
  119.     }
  120.     public function getResponsable(): ?string
  121.     {
  122.         return $this->responsable;
  123.     }
  124.     public function setCategorie(string $categorie): void
  125.     {
  126.         $this->categorie $categorie;
  127.     }
  128.     public function getCategorie(): ?string
  129.     {
  130.         return $this->categorie;
  131.     }
  132.     public function setDescription(string $description): void
  133.     {
  134.         $this->description $description;
  135.     }
  136.     public function getDescription(): ?string
  137.     {
  138.         return $this->description;
  139.     }
  140.     public function setAutoriseContact(bool $autoriseContact): void
  141.     {
  142.         $this->autoriseContact $autoriseContact;
  143.     }
  144.     public function getAutoriseContact(): ?bool
  145.     {
  146.         return $this->autoriseContact;
  147.     }
  148.     public function setEtablissement(Etablissement $etablissement): void
  149.     {
  150.         $this->etablissement $etablissement;
  151.         $this->nom $this->nom ?: $etablissement->getDenomination();
  152.         $this->adresse $this->adresse ?: trim(implode(' ', [
  153.             $etablissement->getAdresse1(),
  154.             $etablissement->getAdresse2(),
  155.             $etablissement->getAdresse3(),
  156.         ]));
  157.         $this->codePostal $this->codePostal ?: $etablissement->getCodePostal();
  158.         $this->ville $this->ville ?: $etablissement->getVille()->getLibelle();
  159.     }
  160.     public function getEtablissement(): ?Etablissement
  161.     {
  162.         return $this->etablissement;
  163.     }
  164. }