src/Entity/Recurrence.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RecurrenceRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=RecurrenceRepository::class)
  9.  */
  10. class Recurrence
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\OneToMany(targetEntity=RDV::class, mappedBy="recurrenceRdvs", cascade={"detach"})
  20.      */
  21.     private $rdvs;
  22.     /**
  23.      * @ORM\OneToMany(targetEntity=RecurrenceProduct::class, mappedBy="recurrence", cascade={"remove"})
  24.      */
  25.     private $recurrenceProducts;
  26.     /**
  27.      * @ORM\Column(type="integer", nullable=true)
  28.      */
  29.     private $nbSemaine;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $type;
  34.     /**
  35.      * @ORM\Column(type="datetime", nullable=true)
  36.      */
  37.     private $createdAt;
  38.     /**
  39.      * @ORM\Column(type="datetime", nullable=true)
  40.      */
  41.     private $jos;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity=Client::class, inversedBy="recurrences")
  44.      */
  45.     private $client;
  46.     public function __construct()
  47.     {
  48.         $this->createdAt =  new \DateTime();
  49.         $this->rdvs = new ArrayCollection();
  50.         $this->recurrenceProducts = new ArrayCollection();
  51.     }
  52.     public function getId(): ?int
  53.     {
  54.         return $this->id;
  55.     }
  56.     /**
  57.      * @return Collection<int, RDV>
  58.      */
  59.     public function getRdvs(): Collection
  60.     {
  61.         return $this->rdvs;
  62.     }
  63.     public function addRdv(RDV $rdv): self
  64.     {
  65.         if (!$this->rdvs->contains($rdv)) {
  66.             $this->rdvs[] = $rdv;
  67.             $rdv->setRecurrenceRdvs($this);
  68.         }
  69.         return $this;
  70.     }
  71.     public function removeRdv(RDV $rdv): self
  72.     {
  73.         if ($this->rdvs->removeElement($rdv)) {
  74.             // set the owning side to null (unless already changed)
  75.             if ($rdv->getRecurrenceRdvs() === $this) {
  76.                 $rdv->setRecurrenceRdvs(null);
  77.             }
  78.         }
  79.         return $this;
  80.     }
  81.     public function getNbSemaine(): ?int
  82.     {
  83.         return $this->nbSemaine;
  84.     }
  85.     public function setNbSemaine(?int $nbSemaine): self
  86.     {
  87.         $this->nbSemaine $nbSemaine;
  88.         return $this;
  89.     }
  90.     public function getType(): ?string
  91.     {
  92.         return $this->type;
  93.     }
  94.     public function setType(?string $type): self
  95.     {
  96.         $this->type $type;
  97.         return $this;
  98.     }
  99.     public function getJos(): ?\DateTimeInterface
  100.     {
  101.         return $this->jos;
  102.     }
  103.     public function setJos(?\DateTimeInterface $jos): self
  104.     {
  105.         $this->jos $jos;
  106.         return $this;
  107.     }
  108.     public function getClient(): ?Client
  109.     {
  110.         return $this->client;
  111.     }
  112.     public function setClient(?Client $client): self
  113.     {
  114.         $this->client $client;
  115.         return $this;
  116.     }
  117.     /**
  118.      * @return Collection<int, RecurrenceProduct>
  119.      */
  120.     public function getRecurrenceProducts(): Collection
  121.     {
  122.         return $this->recurrenceProducts;
  123.     }
  124.     public function addRecurrenceProduct(RecurrenceProduct $recurrenceProduct): self
  125.     {
  126.         if (!$this->recurrenceProducts->contains($recurrenceProduct)) {
  127.             $this->recurrenceProducts[] = $recurrenceProduct;
  128.             $recurrenceProduct->setRecurrence($this);
  129.         }
  130.         return $this;
  131.     }
  132.     public function removeRecurrenceProduct(RecurrenceProduct $recurrenceProduct): self
  133.     {
  134.         if ($this->recurrenceProducts->removeElement($recurrenceProduct)) {
  135.             // Set the owning side to null (unless already changed)
  136.             if ($recurrenceProduct->getRecurrence() === $this) {
  137.                 $recurrenceProduct->setRecurrence(null);
  138.             }
  139.         }
  140.         return $this;
  141.     }
  142.     /**
  143.      * @return \DateTime
  144.      */
  145.     public function getCreatedAt(): \DateTime
  146.     {
  147.         return $this->createdAt;
  148.     }
  149.     /**
  150.      * @param \DateTime $createdAt
  151.      */
  152.     public function setCreatedAt(\DateTime $createdAt): void
  153.     {
  154.         $this->createdAt $createdAt;
  155.     }
  156. }