<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\RDV;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* Salon
*
* @ORM\Table(name="salon")
* @ORM\Entity
*/
class Salon
{
const SERVICE_COIFFURE = 'coiffure';
const SERVICE_ESTHETIQUE = 'esthetique';
const DEFAULT_OPENING_TIME = '10:00:00';
const DEFAULT_CLOSING_TIME = '18:00:00';
/**
* @var int
* @Groups("rdv")
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @Groups("rdv")
* @var string
*
* @ORM\Column(name="name", type="string", length=255, nullable=false)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="service", type="string", nullable=true)
*/
private $service;
/**
* @var bool
*
* @ORM\Column(name="status", type="boolean", nullable=false)
*/
private $status;
/**
* @var array
*
* @ORM\Column(name="openingDays", type="array", nullable=true)
*/
private $openingDays;
/**
* @var \DateTime
*
* @ORM\Column(name="date_activity_end", type="string", nullable=true)
*/
private $dateActivityEnd;
/**
* @var \DateTime
*
* @ORM\Column(name="specific_billing", type="boolean", nullable=true)
*/
private $specificBilling = false;
/**
* @var \DateTime
*
* @ORM\Column(name="date_open", type="string", nullable=true)
*/
private $dateOpen;
/**
* @var \DateTime
*
* @ORM\Column(name="date_end", type="string", nullable=true)
*/
private $dateEnd;
/**
* @ORM\OneToMany(targetEntity="IntervenantSalon", mappedBy="salon", cascade={"persist"})
*/
protected $intervenantSalons;
/**
* @ORM\OneToMany(targetEntity="RDV", mappedBy="salon")
*/
protected $rdvs;
/**
* @Groups("rdv")
* @var Address
*
* @ORM\ManyToOne(targetEntity="Address", cascade={"persist"})
* @ORM\JoinColumn(name="address_id", referencedColumnName="id")
*/
private $address;
/**
* @var GridPrice
*
* @ORM\ManyToOne(targetEntity=GridPrice::class, cascade={"persist"})
* @ORM\JoinColumn(name="gridprice_id", referencedColumnName="id")
*/
private $gridPrice;
/**
* @var Site
*
* @ORM\ManyToOne(targetEntity="Site")
* @ORM\JoinColumn(name="site_id", referencedColumnName="id")
*/
private $site;
/**
* @ORM\Column(type="time", nullable=true)
*/
private $openingTime;
/**
* @ORM\Column(type="time", nullable=true)
*/
private $closingTime;
public function __toString()
{
return $this->name;
}
public function __construct()
{
// $this->dateEnd = new \DateTime();
// $this->dateActivityEnd = new \DateTime();
// $this->dateOpen = new \DateTime();
$this->intervenantSalons = new ArrayCollection();
$this->rdvs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getStatus(): ?bool
{
return $this->status;
}
public function setStatus(bool $status): self
{
$this->status = $status;
return $this;
}
public function getDateActivityEnd()
{
return $this->dateActivityEnd;
}
public function setDateActivityEnd($dateActivityEnd): self
{
$this->dateActivityEnd = $dateActivityEnd;
return $this;
}
public function getDateEnd()
{
return $this->dateEnd;
}
public function setDateEnd($dateEnd): self
{
$this->dateEnd = $dateEnd;
return $this;
}
public function getAddress(): ?Address
{
return $this->address;
}
public function setAddress(?Address $address): self
{
$this->address = $address;
return $this;
}
/**
* @return Site|null
*/
public function getSite(): ?Site
{
return $this->site;
}
/**
* @param Site $site
*/
public function setSite(Site $site): void
{
$this->site = $site;
}
/**
* @return string
*/
public function getService(): ?string
{
return $this->service;
}
/**
* @param string $service
*/
public function setService(string $service): void
{
$this->service = $service;
}
/**
* @return \DateTime
*/
public function getDateOpen()
{
return $this->dateOpen;
}
/**
* @param \DateTime $dateOpen
*/
public function setDateOpen($dateOpen): void
{
$this->dateOpen = $dateOpen;
}
/**
* @return array
*/
public function getOpeningDays(): ?array
{
return $this->openingDays;
}
/**
* @param array $openingDays
*/
public function setOpeningDays(array $openingDays): void
{
$this->openingDays = $openingDays;
}
/**
* @return
*/
public function getIntervenantSalons()
{
return $this->intervenantSalons;
}
/**
* @param Intervenant $intervenantSalons
*/
public function setIntervenantSalons(Intervenant $intervenantSalons): void
{
$this->intervenantSalons = $intervenantSalons;
}
/**
* @return \DateTime
*/
public function getSpecificBilling(): ?bool
{
return $this->specificBilling;
}
/**
* @param $specificBilling
*/
public function setSpecificBilling($specificBilling): void
{
$this->specificBilling = $specificBilling;
}
/*********/
/* ADD */
/********/
public function addIntervenantSalon(IntervenantSalon $item)
{
$this->intervenantSalons->add($item);
$item->setSalon($this);
}
/*********/
/* REMOVE */
/********/
public function removeIntervenantSalon(IntervenantSalon $item)
{
$this->intervenantSalons->removeElement($item);
}
/**
* @return GridPrice
*/
public function getGridPrice(): ?GridPrice
{
return $this->gridPrice;
}
/**
* @param GridPrice $gridPrice
*/
public function setGridPrice(GridPrice $gridPrice): void
{
$this->gridPrice = $gridPrice;
}
public static function getServices(): array
{
return [
self::SERVICE_COIFFURE => 'COIFFURE',
self::SERVICE_ESTHETIQUE => 'ESTHETIQUE',
];
}
public function getOpeningTime(): ?\DateTimeInterface
{
return $this->openingTime;
}
public function setOpeningTime(?\DateTimeInterface $openingTime): self
{
$this->openingTime = $openingTime;
return $this;
}
public function getClosingTime(): ?\DateTimeInterface
{
return $this->closingTime;
}
public function setClosingTime(?\DateTimeInterface $closingTime): self
{
$this->closingTime = $closingTime;
return $this;
}
/**
* @return ArrayCollection
*/
public function getRdvs()
{
return $this->rdvs;
}
/**
* @param ArrayCollection $rdvs
*/
public function setRdvs($rdvs): void
{
$this->rdvs = $rdvs;
}
}