<?php
namespace App\Entity;
use App\Repository\ProfessionelRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity(repositoryClass=ProfessionelRepository::class)
* @Vich\Uploadable
*/
class Professionel
{
const LUNDI = "Lundi";
const MARDI = "Mardi";
const MERCREDI = "Mercredi";
const JEUDI = "Jeudi";
const VENDREDI = "Vendredi";
const SAMEDI = "Samedi";
const DIMANCHE = "Dimanche";
const HORAIRE= array(1=>self::LUNDI,2=>self::MARDI,3=>self::MERCREDI,4 =>self::JEUDI,5=>self::VENDREDI,6=>self::SAMEDI,7=>self::DIMANCHE);
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $raisonSocial;
/**
* @ORM\Column(type="string", length=255)
*/
private $codePostal;
/**
* @ORM\Column(type="string", length=255)
*/
private $ville;
/**
* @ORM\Column(type="string", length=255)
*/
private $nom;
/**
* @ORM\Column(type="boolean")
*/
private $livraison;
/**
* @ORM\Column(type="boolean")
*/
private $contratEntretien;
/**
* @ORM\Column(type="boolean")
*/
private $repriseVoiture;
/**
* @ORM\Column(type="string", length=255)
*/
private $latitude;
/**
* @ORM\Column(type="string", length=255)
*/
private $longitude;
/**
* @ORM\OneToMany(targetEntity=Horaire::class, mappedBy="professionel", cascade={"persist", "remove"})
*/
private Collection $horaire;
/**
* @Vich\UploadableField(mapping="marque_upload", fileNameProperty="logo")
* @var File
*/
private $logoFile;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $logo;
public function __construct()
{
$this->horaire = new ArrayCollection();
for ($i = 1; $i <= 7; $i++){
$this->horaire[$i] = new Horaire();
$this->horaire[$i]->setJour(self::HORAIRE[$i]);
$this->horaire[$i]->setHeureOuvertureMatin(new \DateTime());
$this->horaire[$i]->getHeureOuvertureMatin()->setTime(10, 00);
$this->horaire[$i]->setHeureFermetureMatin(new \DateTime());
$this->horaire[$i]->getHeureFermetureMatin()->setTime(12, 00);
$this->horaire[$i]->setHeureOuvertureApresMidi(new \DateTime());
$this->horaire[$i]->getHeureOuvertureApresMidi()->setTime(14, 00);
$this->horaire[$i]->setHeureFermetrureApresMidi(new \DateTime());
$this->horaire[$i]->getHeureFermetrureApresMidi()->setTime(16, 00);
}
}
public function __toString()
{
return $this->raisonSocial;
}
public function getId(): ?int
{
return $this->id;
}
public function getLogoFile()
{
return $this->logoFile;
}
public function setLogoFile(File $logoFile = null)
{
$this->logoFile = $logoFile;
return $this;
}
public function getRaisonSocial(): ?string
{
return $this->raisonSocial;
}
public function setRaisonSocial(string $raisonSocial): self
{
$this->raisonSocial = $raisonSocial;
return $this;
}
public function getCodePostal(): ?string
{
return $this->codePostal;
}
public function setCodePostal(string $codePostal): self
{
$this->codePostal = $codePostal;
return $this;
}
public function getVille(): ?string
{
return $this->ville;
}
public function setVille(string $ville): self
{
$this->ville = $ville;
return $this;
}
public function isLivraison(): ?bool
{
return $this->livraison;
}
public function setLivraison(bool $livraison): self
{
$this->livraison = $livraison;
return $this;
}
public function isContratEntretien(): ?bool
{
return $this->contratEntretien;
}
public function setContratEntretien(bool $contratEntretien): self
{
$this->contratEntretien = $contratEntretien;
return $this;
}
public function getLatitude(): ?string
{
return $this->latitude;
}
public function setLatitude(string $latitude): self
{
$this->latitude = $latitude;
return $this;
}
public function getLongitude(): ?string
{
return $this->longitude;
}
public function setLongitude(string $longitude): self
{
$this->longitude = $longitude;
return $this;
}
public function addHoraire(Horaire $horaire): self
{
if (!$this->horaire->contains($horaire)) {
$this->horaire[] = $horaire;
$horaire->setProfessionel($this);
}
return $this;
}
public function removeHoraire(Horaire $horaire): self
{
if ($this->horaire->contains($horaire)) {
$this->horaire->removeElement($horaire);
// set the owning side to null (unless already changed)
if ($horaire->getProfessionel() === $this) {
$horaire->setProfessionel(null);
}
}
return $this;
}
/**
* @return Collection|Horaire[]
*/
public function getHoraire(): Collection
{
return $this->horaire;
}
public function isRepriseVoiture(): ?bool
{
return $this->repriseVoiture;
}
public function setRepriseVoiture(bool $repriseVoiture): self
{
$this->repriseVoiture = $repriseVoiture;
return $this;
}
public function getLogo(): ?string
{
return $this->logo;
}
public function setLogo(?string $logo): self
{
$this->logo = $logo;
return $this;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
}