<?php
namespace App\Entity;
use App\Repository\RecurrenceRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=RecurrenceRepository::class)
*/
class Recurrence
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\OneToMany(targetEntity=RDV::class, mappedBy="recurrenceRdvs", cascade={"detach"})
*/
private $rdvs;
/**
* @ORM\OneToMany(targetEntity=RecurrenceProduct::class, mappedBy="recurrence", cascade={"remove"})
*/
private $recurrenceProducts;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $nbSemaine;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $type;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $jos;
/**
* @ORM\ManyToOne(targetEntity=Client::class, inversedBy="recurrences")
*/
private $client;
public function __construct()
{
$this->createdAt = new \DateTime();
$this->rdvs = new ArrayCollection();
$this->recurrenceProducts = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @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->setRecurrenceRdvs($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->getRecurrenceRdvs() === $this) {
$rdv->setRecurrenceRdvs(null);
}
}
return $this;
}
public function getNbSemaine(): ?int
{
return $this->nbSemaine;
}
public function setNbSemaine(?int $nbSemaine): self
{
$this->nbSemaine = $nbSemaine;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getJos(): ?\DateTimeInterface
{
return $this->jos;
}
public function setJos(?\DateTimeInterface $jos): self
{
$this->jos = $jos;
return $this;
}
public function getClient(): ?Client
{
return $this->client;
}
public function setClient(?Client $client): self
{
$this->client = $client;
return $this;
}
/**
* @return Collection<int, RecurrenceProduct>
*/
public function getRecurrenceProducts(): Collection
{
return $this->recurrenceProducts;
}
public function addRecurrenceProduct(RecurrenceProduct $recurrenceProduct): self
{
if (!$this->recurrenceProducts->contains($recurrenceProduct)) {
$this->recurrenceProducts[] = $recurrenceProduct;
$recurrenceProduct->setRecurrence($this);
}
return $this;
}
public function removeRecurrenceProduct(RecurrenceProduct $recurrenceProduct): self
{
if ($this->recurrenceProducts->removeElement($recurrenceProduct)) {
// Set the owning side to null (unless already changed)
if ($recurrenceProduct->getRecurrence() === $this) {
$recurrenceProduct->setRecurrence(null);
}
}
return $this;
}
/**
* @return \DateTime
*/
public function getCreatedAt(): \DateTime
{
return $this->createdAt;
}
/**
* @param \DateTime $createdAt
*/
public function setCreatedAt(\DateTime $createdAt): void
{
$this->createdAt = $createdAt;
}
}