src/Entity/AgendaDay.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\Timestampable;
  4. use App\Repository\AgendaDayRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use JMS\Serializer\Annotation\Groups;
  9. #[ORM\HasLifecycleCallbacks]
  10. #[ORM\Entity(repositoryClassAgendaDayRepository::class)]
  11. class AgendaDay
  12. {
  13.     use Timestampable;
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     #[Groups(['getAgenda'])]
  18.     private ?int $id null;
  19.     #[ORM\Column(length255)]
  20.     #[Groups(['getAgenda'])]
  21.     private ?string $name null;
  22.     #[ORM\OneToMany(mappedBy'agendaDay'targetEntityAgendaElement::class, cascade: ['remove'], orphanRemovaltrue)]
  23.     #[Groups(['getAgenda'])]
  24.     private Collection $elements;
  25.     #[ORM\ManyToOne(inversedBy'agendaDays'cascade: ["persist"])]
  26.     #[ORM\JoinColumn(nullablefalse)]
  27.     private ?User $author null;
  28.     #[ORM\Column(length255)]
  29.     private ?string $nameEn null;
  30.     #[ORM\ManyToOne(inversedBy'agendaDays')]
  31.     #[ORM\JoinColumn(nullablefalse)]
  32.     private ?TheClass $classe null;
  33.     #[ORM\ManyToOne(inversedBy'agendaDays')]
  34.     #[ORM\JoinColumn(nullablefalse)]
  35.     private ?School $school null;
  36.     #[ORM\ManyToOne(inversedBy'agendaDays')]
  37.     #[ORM\JoinColumn(nullablefalse)]
  38.     private ?SchoolYear $year null;
  39.     public function __construct()
  40.     {
  41.         $this->elements = new ArrayCollection();
  42.     }
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getName(): ?string
  48.     {
  49.         return $this->name;
  50.     }
  51.     public function setName(string $name): static
  52.     {
  53.         $this->name $name;
  54.         return $this;
  55.     }
  56.     /**
  57.      * @return Collection<int, AgendaElement>
  58.      */
  59.     public function getElements(): Collection
  60.     {
  61.         return $this->elements;
  62.     }
  63.     public function addElement(AgendaElement $element): static
  64.     {
  65.         if (!$this->elements->contains($element)) {
  66.             $this->elements->add($element);
  67.             $element->setAgendaDay($this);
  68.         }
  69.         return $this;
  70.     }
  71.     public function removeElement(AgendaElement $element): static
  72.     {
  73.         if ($this->elements->removeElement($element)) {
  74.             // set the owning side to null (unless already changed)
  75.             if ($element->getAgendaDay() === $this) {
  76.                 $element->setAgendaDay(null);
  77.             }
  78.         }
  79.         return $this;
  80.     }
  81.     public function getAuthor(): ?User
  82.     {
  83.         return $this->author;
  84.     }
  85.     public function setAuthor(?User $author): static
  86.     {
  87.         $this->author $author;
  88.         return $this;
  89.     }
  90.     public function getNameEn(): ?string
  91.     {
  92.         return $this->nameEn;
  93.     }
  94.     public function setNameEn(string $nameEn): static
  95.     {
  96.         $this->nameEn $nameEn;
  97.         return $this;
  98.     }
  99.     public function getClasse(): ?TheClass
  100.     {
  101.         return $this->classe;
  102.     }
  103.     public function setClasse(?TheClass $classe): static
  104.     {
  105.         $this->classe $classe;
  106.         return $this;
  107.     }
  108.     public function getSchool(): ?School
  109.     {
  110.         return $this->school;
  111.     }
  112.     public function setSchool(?School $school): static
  113.     {
  114.         $this->school $school;
  115.         return $this;
  116.     }
  117.     public function getYear(): ?SchoolYear
  118.     {
  119.         return $this->year;
  120.     }
  121.     public function setYear(?SchoolYear $year): static
  122.     {
  123.         $this->year $year;
  124.         return $this;
  125.     }
  126. }