<?php
namespace App\Entity;
use App\Entity\Traits\Timestampable;
use App\Repository\StudentSubjectExemptionRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* Dispense d'un élève pour une matière, pour toute l'année scolaire (portée
* = son inscription StudentYear, donc classe + année). Tant qu'une ligne
* existe pour (studentYear, subject), cet élève est traité comme "n'ayant
* pas composé" cette matière partout (bulletin, stats, classement, saisie
* de notes) — même mécanisme que l'absence de Note pour une séquence, mais
* appliqué à l'année entière. Les Note déjà saisies ne sont jamais
* supprimées : seulement ignorées tant que la dispense est active.
*/
#[ORM\HasLifecycleCallbacks]
#[ORM\Entity(repositoryClass: StudentSubjectExemptionRepository::class)]
#[ORM\UniqueConstraint(columns: ['student_year_id', 'subject_id'])]
class StudentSubjectExemption
{
use Timestampable;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'subjectExemptions')]
#[ORM\JoinColumn(nullable: false)]
private ?StudentYear $studentYear = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?Subject $subject = null;
#[ORM\ManyToOne]
private ?User $author = null;
public function getId(): ?int
{
return $this->id;
}
public function getStudentYear(): ?StudentYear
{
return $this->studentYear;
}
public function setStudentYear(?StudentYear $studentYear): static
{
$this->studentYear = $studentYear;
return $this;
}
public function getSubject(): ?Subject
{
return $this->subject;
}
public function setSubject(?Subject $subject): static
{
$this->subject = $subject;
return $this;
}
public function getAuthor(): ?User
{
return $this->author;
}
public function setAuthor(?User $author): static
{
$this->author = $author;
return $this;
}
}