src/Entity/Sequence.php line 52

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SequenceRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use App\Entity\Traits\Period;
  9. use JsonSerializable;
  10. /**
  11.  * @ORM\Entity(repositoryClass=SequenceRepository::class)
  12.  */
  13. class Sequence implements JsonSerializable
  14. {
  15.     use Period;
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=Quater::class, inversedBy="sequences")
  24.      * @ORM\JoinColumn(nullable=false)
  25.      */
  26.     private $quater;
  27.     /**
  28.      * @ORM\Column(type="datetime")
  29.      */
  30.     private $validationDate;
  31.     /**
  32.      * @ORM\OneToMany(targetEntity=Evaluation::class, mappedBy="sequence", orphanRemoval=true)
  33.      */
  34.     private $evaluations;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=AbscenceSheet::class, mappedBy="sequence", orphanRemoval=true)
  37.      */
  38.     private $abscenceSheets;
  39.     public function __construct()
  40.     {
  41.         $this->evaluations = new ArrayCollection();
  42.         $this->abscenceSheets = new ArrayCollection();
  43.     }
  44.     public function jsonSerialize()
  45.     {
  46.         return [
  47.             'wording' => strtolower($this->wording),
  48.         ];
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getQuater(): ?Quater
  55.     {
  56.         return $this->quater;
  57.     }
  58.     public function setQuater(?Quater $quater): self
  59.     {
  60.         $this->quater $quater;
  61.         return $this;
  62.     }
  63.     public function getValidationDate(): ?\DateTimeInterface
  64.     {
  65.         return $this->validationDate;
  66.     }
  67.     public function setValidationDate(\DateTimeInterface $validationDate): self
  68.     {
  69.         $this->validationDate $validationDate;
  70.         return $this;
  71.     }
  72.     /**
  73.      * @return Collection|Evaluation[]
  74.      */
  75.     public function getEvaluations(): Collection
  76.     {
  77.         return $this->evaluations;
  78.     }
  79.     public function addEvaluation(Evaluation $evaluation): self
  80.     {
  81.         if (!$this->evaluations->contains($evaluation)) {
  82.             $this->evaluations[] = $evaluation;
  83.             $evaluation->setSequence($this);
  84.         }
  85.         return $this;
  86.     }
  87.     public function removeEvaluation(Evaluation $evaluation): self
  88.     {
  89.         if ($this->evaluations->removeElement($evaluation)) {
  90.             // set the owning side to null (unless already changed)
  91.             if ($evaluation->getSequence() === $this) {
  92.                 $evaluation->setSequence(null);
  93.             }
  94.         }
  95.         return $this;
  96.     }
  97.     public function unable()
  98.     {
  99.         $this->setActivated(true);
  100.     }
  101.     public function disable()
  102.     {
  103.         $this->setActivated(false);
  104.     }
  105.     /**
  106.      * @return Collection<int, AbscenceSheet>
  107.      */
  108.     public function getAbscenceSheets(): Collection
  109.     {
  110.         return $this->abscenceSheets;
  111.     }
  112.     public function addAbscenceSheet(AbscenceSheet $abscenceSheet): static
  113.     {
  114.         if (!$this->abscenceSheets->contains($abscenceSheet)) {
  115.             $this->abscenceSheets->add($abscenceSheet);
  116.             $abscenceSheet->setSequence($this);
  117.         }
  118.         return $this;
  119.     }
  120.     public function removeAbscenceSheet(AbscenceSheet $abscenceSheet): static
  121.     {
  122.         if ($this->abscenceSheets->removeElement($abscenceSheet)) {
  123.             // set the owning side to null (unless already changed)
  124.             if ($abscenceSheet->getSequence() === $this) {
  125.                 $abscenceSheet->setSequence(null);
  126.             }
  127.         }
  128.         return $this;
  129.     }
  130. }