<?php
/**
* Created by PhpStorm.
* User: maxime
* Date: 2019-04-16
* Time: 19:56
*/
namespace App\Entity;
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Salon;
use App\Entity\Intervenant;
use Symfony\Component\Serializer\Annotation\Groups;
use App\Repository\SessionSalonRepository;
/**
* Salon
*
* @ORM\Table(name="session_salon")
* @ORM\Entity(repositoryClass=SessionSalonRepository::class)
*/
class SessionSalon
{
/**
* @var int
* @Groups("rdv")
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
const STATUS_PLANIFIER = 'plan';
const STATUS_MODIFIER = 'modifier';
const STATUS_INDISPONIBLE = 'indisponible';
const STATUS_EVENT = 'event';
/**
* @Groups("rdv")
* @ORM\ManyToOne(targetEntity=Salon::class, inversedBy="session", cascade={"persist"})
* @ORM\JoinColumn(name="salon_id", referencedColumnName="id")
*
*/
protected $salon;
/**
* @ORM\ManyToOne(targetEntity=Intervenant::class, inversedBy="session", cascade={"persist"})
* @ORM\JoinColumn(name="intervenant_id", referencedColumnName="id")
*
*/
protected $intervenant;
/**
* @Groups("rdv")
* @var string|null
*
* @ORM\Column(name="start", type="datetime", nullable=true)
*/
private $start;
/**
* @Groups("rdv")
* @var string|null
*
* @ORM\Column(name="end", type="datetime", nullable=true)
*/
private $end;
/**
* @var string|null
*
* @ORM\Column(name="comment", type="text", nullable=true)
*/
private $comment;
/**
* @var string|null
*
* @ORM\Column(name="horaires", type="text", nullable=true)
*/
private $horaire;
/**
* @var string|null
* @Groups("rdv")
* @ORM\Column(name="status", type="string", nullable=true)
*/
private $status = self::STATUS_PLANIFIER;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $actionArealiser;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $observation;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $createdAt;
/**
* @ORM\OneToMany(targetEntity=LogPlanning::class, mappedBy="intervenantOld", cascade={"remove","persist"})
*/
private $logPlannings;
/**
* @ORM\OneToMany(targetEntity=LogCancel::class, mappedBy="sessionSalon", cascade={"remove","persist"})
*/
private $logCancels;
/**
* @ORM\OneToMany(targetEntity=LogPlanning::class, mappedBy="sessionSalon", cascade={"remove","persist"})
*/
private $logPlanningsSession;
public function __construct()
{
$this->createdAt = new \DateTime();
$this->logPlannings = new ArrayCollection();
$this->logCancels = new ArrayCollection();
$this->logPlanningsSession = new ArrayCollection();
}
public function __toString(){
return $this->getSalon() ? $this->getSalon()->getName() : (string) $this->getId();
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
*/
public function setId(int $id): void
{
$this->id = $id;
}
/**
* @return mixed
*/
public function getSalon()
{
return $this->salon;
}
/**
* @param mixed $salon
*/
public function setSalon($salon): void
{
$this->salon = $salon;
}
/**
* @return mixed
*/
public function getIntervenant()
{
return $this->intervenant;
}
/**
* @param mixed $intervenant
*/
public function setIntervenant($intervenant): void
{
$this->intervenant = $intervenant;
}
/**
* @return \DateTime|null
*/
public function getStart()
{
return $this->start;
}
/**
* @param string|null $start
*/
public function setStart($start): void
{
$this->start = $start;
}
/**
* @return string|null
*/
public function getComment(): ?string
{
return $this->comment;
}
/**
* @param string|null $comment
*/
public function setComment(?string $comment): void
{
$this->comment = $comment;
}
/**
* @return string|null
*/
public function getStatus(): ?string
{
return $this->status;
}
/**
* @param string|null $status
*/
public function setStatus(?string $status): void
{
$this->status = $status;
}
/**
* @return string|null
*/
public function getHoraire(): ?string
{
return $this->horaire;
}
/**
* @param string|null $horaire
*/
public function setHoraire(?string $horaire): void
{
$this->horaire = $horaire;
}
/**
* @return string|null
*/
public function getEnd()
{
return $this->end;
}
/**
* @param string|null $end
*/
public function setEnd($end): void
{
$this->end = $end;
}
public function getActionArealiser(): ?bool
{
return $this->actionArealiser;
}
public function setActionArealiser(?bool $actionArealiser): self
{
$this->actionArealiser = $actionArealiser;
return $this;
}
/**
* @return mixed
*/
public function getObservation()
{
return $this->observation;
}
/**
* @param mixed $observation
*/
public function setObservation($observation): void
{
$this->observation = $observation;
}
/**
* @return \DateTime
*/
public function getCreatedAt(): \DateTime
{
return $this->createdAt;
}
/**
* @param \DateTime $createdAt
*/
public function setCreatedAt(\DateTime $createdAt): void
{
$this->createdAt = $createdAt;
}
/**
* @return Collection<int, LogPlanning>
*/
public function getLogPlannings(): Collection
{
return $this->logPlannings;
}
public function addLogPlanning(LogPlanning $logPlanning): self
{
if (!$this->logPlannings->contains($logPlanning)) {
$this->logPlannings[] = $logPlanning;
$logPlanning->setIntervenantOld($this);
}
return $this;
}
public function removeLogPlanning(LogPlanning $logPlanning): self
{
if ($this->logPlannings->removeElement($logPlanning)) {
// set the owning side to null (unless already changed)
if ($logPlanning->getIntervenantOld() === $this) {
$logPlanning->setIntervenantOld(null);
}
}
return $this;
}
/**
* @return Collection<int, LogPlanning>
*/
public function getLogCancels(): Collection
{
return $this->logCancels;
}
public function addLogCancel(LogCancel $logCancel): self
{
if (!$this->logCancels->contains($logCancel)) {
$this->logCancels[] = $logCancel;
$logCancel->setIntervenantOld($this);
}
return $this;
}
public function removeLogCancel(LogCancel $logCancel): self
{
if ($this->logCancels->removeElement($logCancel)) {
// set the owning side to null (unless already changed)
if ($logCancel->getIntervenantOld() === $this) {
$logCancel->setIntervenantOld(null);
}
}
return $this;
}
/**
* @return Collection|LogPlanning[]
*/
public function getLogPlanningsSession(): Collection
{
return $this->logPlanningsSession;
}
public function addLogPlanningsSession(LogPlanning $logPlanning): self
{
if (!$this->logPlanningsSession->contains($logPlanning)) {
$this->logPlanningsSession[] = $logPlanning;
$logPlanning->setSessionSalon($this);
}
return $this;
}
public function removeLogPlanningsSession(LogPlanning $logPlanning): self
{
if ($this->logPlanningsSession->removeElement($logPlanning)) {
// set the owning side to null (unless already changed)
if ($logPlanning->getSessionSalon() === $this) {
$logPlanning->setSessionSalon(null);
}
}
return $this;
}
}