src/Entity/Professionel.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProfessionelRepository;
  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 Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. /**
  10.  * @ORM\Entity(repositoryClass=ProfessionelRepository::class)
  11.  * @Vich\Uploadable
  12.  */
  13. class Professionel
  14. {
  15.     const LUNDI "Lundi";
  16.     const MARDI "Mardi";
  17.     const MERCREDI "Mercredi";
  18.     const JEUDI "Jeudi";
  19.     const VENDREDI "Vendredi";
  20.     const SAMEDI "Samedi";
  21.     const DIMANCHE "Dimanche";
  22.     const HORAIRE= array(1=>self::LUNDI,2=>self::MARDI,3=>self::MERCREDI,=>self::JEUDI,5=>self::VENDREDI,6=>self::SAMEDI,7=>self::DIMANCHE);
  23.     /**
  24.      * @ORM\Id
  25.      * @ORM\GeneratedValue
  26.      * @ORM\Column(type="integer")
  27.      */
  28.     private $id;
  29.     /**
  30.      * @ORM\Column(type="string", length=255)
  31.      */
  32.     private $raisonSocial;
  33.     /**
  34.      * @ORM\Column(type="string", length=255)
  35.      */
  36.     private $codePostal;
  37.     /**
  38.      * @ORM\Column(type="string", length=255)
  39.      */
  40.     private $ville;
  41.     /**
  42.      * @ORM\Column(type="string", length=255)
  43.      */
  44.     private $nom;
  45.     /**
  46.      * @ORM\Column(type="boolean")
  47.      */
  48.     private $livraison;
  49.     /**
  50.      * @ORM\Column(type="boolean")
  51.      */
  52.     private $contratEntretien;
  53.     /**
  54.      * @ORM\Column(type="boolean")
  55.      */
  56.     private $repriseVoiture;
  57.     /**
  58.      * @ORM\Column(type="string", length=255)
  59.      */
  60.     private $latitude;
  61.     /**
  62.      * @ORM\Column(type="string", length=255)
  63.      */
  64.     private $longitude;
  65.     /**
  66.      * @ORM\OneToMany(targetEntity=Horaire::class, mappedBy="professionel", cascade={"persist", "remove"})
  67.      */
  68.     private Collection $horaire;
  69.     /**
  70.      * @Vich\UploadableField(mapping="marque_upload", fileNameProperty="logo")
  71.      * @var File
  72.      */
  73.     private $logoFile;
  74.     /**
  75.      * @ORM\Column(type="string", length=50, nullable=true)
  76.      */
  77.     private $logo;
  78.     public function __construct()
  79.     {
  80.         $this->horaire = new ArrayCollection();
  81.         for ($i 1$i <= 7$i++){
  82.             $this->horaire[$i] = new Horaire();
  83.             $this->horaire[$i]->setJour(self::HORAIRE[$i]);
  84.             $this->horaire[$i]->setHeureOuvertureMatin(new \DateTime());
  85.             $this->horaire[$i]->getHeureOuvertureMatin()->setTime(1000);
  86.             $this->horaire[$i]->setHeureFermetureMatin(new \DateTime());
  87.             $this->horaire[$i]->getHeureFermetureMatin()->setTime(1200);
  88.             $this->horaire[$i]->setHeureOuvertureApresMidi(new \DateTime());
  89.             $this->horaire[$i]->getHeureOuvertureApresMidi()->setTime(1400);
  90.             $this->horaire[$i]->setHeureFermetrureApresMidi(new \DateTime());
  91.             $this->horaire[$i]->getHeureFermetrureApresMidi()->setTime(1600);
  92.         }
  93.     }
  94.     public function __toString()
  95.     {
  96.         return $this->raisonSocial;
  97.     }
  98.     public function getId(): ?int
  99.     {
  100.         return $this->id;
  101.     }
  102.     public function getLogoFile()
  103.     {
  104.         return $this->logoFile;
  105.     }
  106.     public function setLogoFile(File $logoFile null)
  107.     {
  108.         $this->logoFile $logoFile;
  109.         return $this;
  110.     }
  111.     public function getRaisonSocial(): ?string
  112.     {
  113.         return $this->raisonSocial;
  114.     }
  115.     public function setRaisonSocial(string $raisonSocial): self
  116.     {
  117.         $this->raisonSocial $raisonSocial;
  118.         return $this;
  119.     }
  120.     public function getCodePostal(): ?string
  121.     {
  122.         return $this->codePostal;
  123.     }
  124.     public function setCodePostal(string $codePostal): self
  125.     {
  126.         $this->codePostal $codePostal;
  127.         return $this;
  128.     }
  129.     public function getVille(): ?string
  130.     {
  131.         return $this->ville;
  132.     }
  133.     public function setVille(string $ville): self
  134.     {
  135.         $this->ville $ville;
  136.         return $this;
  137.     }
  138.     public function isLivraison(): ?bool
  139.     {
  140.         return $this->livraison;
  141.     }
  142.     public function setLivraison(bool $livraison): self
  143.     {
  144.         $this->livraison $livraison;
  145.         return $this;
  146.     }
  147.     public function isContratEntretien(): ?bool
  148.     {
  149.         return $this->contratEntretien;
  150.     }
  151.     public function setContratEntretien(bool $contratEntretien): self
  152.     {
  153.         $this->contratEntretien $contratEntretien;
  154.         return $this;
  155.     }
  156.     public function getLatitude(): ?string
  157.     {
  158.         return $this->latitude;
  159.     }
  160.     public function setLatitude(string $latitude): self
  161.     {
  162.         $this->latitude $latitude;
  163.         return $this;
  164.     }
  165.     public function getLongitude(): ?string
  166.     {
  167.         return $this->longitude;
  168.     }
  169.     public function setLongitude(string $longitude): self
  170.     {
  171.         $this->longitude $longitude;
  172.         return $this;
  173.     }
  174.     public function addHoraire(Horaire $horaire): self
  175.     {
  176.         if (!$this->horaire->contains($horaire)) {
  177.             $this->horaire[] = $horaire;
  178.             $horaire->setProfessionel($this);
  179.         }
  180.         return $this;
  181.     }
  182.     public function removeHoraire(Horaire $horaire): self
  183.     {
  184.         if ($this->horaire->contains($horaire)) {
  185.             $this->horaire->removeElement($horaire);
  186.             // set the owning side to null (unless already changed)
  187.             if ($horaire->getProfessionel() === $this) {
  188.                 $horaire->setProfessionel(null);
  189.             }
  190.         }
  191.         return $this;
  192.     }
  193.     /**
  194.      * @return Collection|Horaire[]
  195.      */
  196.     public function getHoraire(): Collection
  197.     {
  198.         return $this->horaire;
  199.     }
  200.     public function isRepriseVoiture(): ?bool
  201.     {
  202.         return $this->repriseVoiture;
  203.     }
  204.     public function setRepriseVoiture(bool $repriseVoiture): self
  205.     {
  206.         $this->repriseVoiture $repriseVoiture;
  207.         return $this;
  208.     }
  209.     public function getLogo(): ?string
  210.     {
  211.         return $this->logo;
  212.     }
  213.     public function setLogo(?string $logo): self
  214.     {
  215.         $this->logo $logo;
  216.         return $this;
  217.     }
  218.     public function getNom(): ?string
  219.     {
  220.         return $this->nom;
  221.     }
  222.     public function setNom(string $nom): self
  223.     {
  224.         $this->nom $nom;
  225.         return $this;
  226.     }
  227. }