src/Entity/Module.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ModuleRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use App\Entity\Traits\Timestampable;
  8. /**
  9.  * Module / Thème du programme national (créé par le superadmin).
  10.  *
  11.  * Niveau optionnel au-dessus de l'Unité d'Apprentissage (LearningUnit) et
  12.  * de la Leçon (Lesson) — certaines matières (ex: histoire-géo) n'ont ni
  13.  * Module ni UA, seulement des leçons ; d'autres (ex: informatique) ont les
  14.  * deux. `position` définit l'ordre d'apparition dans le programme.
  15.  */
  16. #[ORM\HasLifecycleCallbacks]
  17. #[ORM\Entity(repositoryClassModuleRepository::class)]
  18. class Module
  19. {
  20.     use Timestampable;
  21.     #[ORM\Id]
  22.     #[ORM\GeneratedValue]
  23.     #[ORM\Column]
  24.     private ?int $id null;
  25.     #[ORM\Column(length255)]
  26.     private ?string $title null;
  27.     #[ORM\Column(length255nullabletrue)]
  28.     private ?string $titleEn null;
  29.     #[ORM\Column]
  30.     private ?int $position null;
  31.     #[ORM\ManyToOne(inversedBy'modules')]
  32.     #[ORM\JoinColumn(nullablefalse)]
  33.     private ?SubjectReference $subjectReference null;
  34.     #[ORM\OneToMany(mappedBy'module'targetEntityLearningUnit::class)]
  35.     #[ORM\OrderBy(['position' => 'ASC'])]
  36.     private Collection $learningUnits;
  37.     #[ORM\OneToMany(mappedBy'module'targetEntityLesson::class)]
  38.     private Collection $lessons;
  39.     #[ORM\ManyToOne]
  40.     private ?User $author null;
  41.     public function __construct()
  42.     {
  43.         $this->learningUnits = new ArrayCollection();
  44.         $this->lessons = new ArrayCollection();
  45.     }
  46.     public function __toString(): string
  47.     {
  48.         return $this->title ?? '';
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getTitle(): ?string
  55.     {
  56.         return $this->title;
  57.     }
  58.     public function setTitle(string $title): static
  59.     {
  60.         $this->title $title;
  61.         return $this;
  62.     }
  63.     public function getTitleEn(): ?string
  64.     {
  65.         return $this->titleEn;
  66.     }
  67.     public function setTitleEn(?string $titleEn): static
  68.     {
  69.         $this->titleEn $titleEn;
  70.         return $this;
  71.     }
  72.     public function getPosition(): ?int
  73.     {
  74.         return $this->position;
  75.     }
  76.     public function setPosition(int $position): static
  77.     {
  78.         $this->position $position;
  79.         return $this;
  80.     }
  81.     public function getSubjectReference(): ?SubjectReference
  82.     {
  83.         return $this->subjectReference;
  84.     }
  85.     public function setSubjectReference(?SubjectReference $subjectReference): static
  86.     {
  87.         $this->subjectReference $subjectReference;
  88.         return $this;
  89.     }
  90.     /** @return Collection<int, LearningUnit> */
  91.     public function getLearningUnits(): Collection
  92.     {
  93.         return $this->learningUnits;
  94.     }
  95.     /** @return Collection<int, Lesson> */
  96.     public function getLessons(): Collection
  97.     {
  98.         return $this->lessons;
  99.     }
  100.     public function getAuthor(): ?User
  101.     {
  102.         return $this->author;
  103.     }
  104.     public function setAuthor(?User $author): static
  105.     {
  106.         $this->author $author;
  107.         return $this;
  108.     }
  109. }