<?php
namespace App\Entity;
use App\Repository\PromoCodeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=PromoCodeRepository::class)
*/
class PromoCode
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $name;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $purcent;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $type;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $code;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateDebut;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateFin;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $service;
/**
* @ORM\OneToMany(targetEntity=RDV::class, mappedBy="codePromo")
*/
private $rDVs;
public function __construct()
{
$this->rDVs = new ArrayCollection();
}
public function __toString()
{
return (string) $this->code;
}
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 getPurcent(): ?float
{
return $this->purcent;
}
public function setPurcent(?float $purcent): self
{
$this->purcent = $purcent;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(?string $code): self
{
$this->code = $code;
return $this;
}
public function getDateDebut(): ?\DateTimeInterface
{
return $this->dateDebut;
}
public function setDateDebut(?\DateTimeInterface $dateDebut): self
{
$this->dateDebut = $dateDebut;
return $this;
}
public function getDateFin(): ?\DateTimeInterface
{
return $this->dateFin;
}
public function setDateFin(?\DateTimeInterface $dateFin): self
{
$this->dateFin = $dateFin;
return $this;
}
public function getService(): ?string
{
return $this->service;
}
public function setService(?string $service): self
{
$this->service = $service;
return $this;
}
/**
* @return Collection<int, RDV>
*/
public function getRDVs(): Collection
{
return $this->rDVs;
}
public function addRDV(RDV $rDV): self
{
if (!$this->rDVs->contains($rDV)) {
$this->rDVs[] = $rDV;
$rDV->setCodePromo($this);
}
return $this;
}
public function removeRDV(RDV $rDV): self
{
if ($this->rDVs->removeElement($rDV)) {
// set the owning side to null (unless already changed)
if ($rDV->getCodePromo() === $this) {
$rDV->setCodePromo(null);
}
}
return $this;
}
}