<?php
namespace App\Entity;
use App\Repository\StudentRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Traits\Timestampable;
use JMS\Serializer\Annotation\Groups;
#[ORM\HasLifecycleCallbacks]
#[ORM\Entity(repositoryClass: StudentRepository::class)]
class Student
{
use Timestampable;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['getLate','getAbsence','note','getBulletin','getPunish','getStudents','getExamStudent'])]
private ?int $id = null;
#[ORM\Column(length: 255)]
#[Groups(['getLate','getAbsence','note','getBulletin','getPunish','getStudents','getExamStudent'])]
private ?string $firstName = null;
#[ORM\Column(length: 255)]
#[Groups(['getLate','getAbsence','note','getBulletin','getPunish','getStudents','getExamStudent'])]
private ?string $lastName = null;
#[ORM\Column(length: 255,nullable: true)]
#[Groups(['getLate','getAbsence','note','getBulletin','getStudents'])]
private ?string $matricule = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bornLocation = null;
#[ORM\ManyToOne(cascade: ["persist"], inversedBy: 'students')]
#[Groups(['getStudents'])]
#[ORM\JoinColumn(nullable: true)]
private ?User $parent = null;
#[ORM\OneToMany(mappedBy: 'student', targetEntity: StudentYear::class)]
private Collection $studentYears;
#[ORM\OneToMany(mappedBy: 'student', targetEntity: Late::class)]
private Collection $lates;
#[ORM\OneToMany(mappedBy: 'student', targetEntity: Absence::class)]
private Collection $absences;
#[ORM\OneToMany(mappedBy: 'student', targetEntity: Note::class)]
private Collection $notes;
#[ORM\Column(length: 255, nullable: true)]
private ?string $fullName = null;
#[ORM\ManyToOne(inversedBy: 'studentsEdited', cascade: ["persist"])]
private ?User $editor = null;
#[ORM\ManyToOne(inversedBy: 'studentsCreated', cascade: ["persist"])]
private ?User $author = null;
#[ORM\OneToMany(mappedBy: 'student', targetEntity: Punish::class, orphanRemoval: true)]
private Collection $punishes;
#[ORM\Column(length: 255)]
#[Groups(['getStudents'])]
private ?string $sexe = null;
#[ORM\ManyToOne(inversedBy: 'students', cascade: ["persist"])]
#[ORM\JoinColumn(nullable: true)]
private ?School $school = null;
#[ORM\OneToMany(mappedBy: 'student', targetEntity: DisciplineWarning::class)]
private Collection $disciplineWarnings;
#[ORM\OneToMany(mappedBy: 'student', targetEntity: DisciplineBlame::class)]
private Collection $disciplineBlames;
#[ORM\OneToMany(mappedBy: 'student', targetEntity: DisciplineExclusion::class)]
private Collection $disciplineExclusions;
#[ORM\OneToMany(mappedBy: 'student', targetEntity: DisciplineRetained::class)]
private Collection $disciplineRetaineds;
#[ORM\OneToOne(mappedBy: 'student', cascade: ['persist', 'remove'])]
private ?DefinitiveExclusion $definitiveExclusion = null;
#[ORM\OneToMany(mappedBy: 'student', targetEntity: DisciplineConcile::class)]
private Collection $disciplineConciles;
#[ORM\OneToMany(mappedBy: 'student', targetEntity: PrimaryNote::class)]
private Collection $primaryNotes;
#[ORM\OneToMany(mappedBy: 'student', targetEntity: DisciplinePunish::class)]
private Collection $disciplinePunishes;
#[ORM\Column(length: 255, nullable: true)]
private ?string $picture = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bornArrondissement = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bornDepartement = null;
#[ORM\OneToMany(mappedBy: 'student', targetEntity: Blame::class)]
private Collection $blames;
#[ORM\OneToMany(mappedBy: 'student', targetEntity: Warning::class)]
private Collection $warnings;
#[ORM\OneToMany(mappedBy: 'student', targetEntity: Retained::class)]
private Collection $retaineds;
#[ORM\Column(length: 255, nullable: true)]
private ?string $father = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $mother = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $bornDay = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $govMatricule = null;
public function __construct()
{
$this->studentYears = new ArrayCollection();
$this->lates = new ArrayCollection();
$this->absences = new ArrayCollection();
$this->notes = new ArrayCollection();
$this->punishes = new ArrayCollection();
$this->disciplineWarnings = new ArrayCollection();
$this->disciplineBlames = new ArrayCollection();
$this->disciplineExclusions = new ArrayCollection();
$this->disciplineRetaineds = new ArrayCollection();
$this->disciplineConciles = new ArrayCollection();
$this->primaryNotes = new ArrayCollection();
$this->disciplinePunishes = new ArrayCollection();
$this->blames = new ArrayCollection();
$this->warnings = new ArrayCollection();
$this->retaineds = new ArrayCollection();
}
public function __toString(): string
{
return $this->getFullName();
}
public function getFullName():string
{
return $this->lastName.' '.$this->firstName;
}
public function getId(): ?int
{
return $this->id;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(string $firstName): static
{
$this->firstName = $firstName;
return $this;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(string $lastName): static
{
$this->lastName = $lastName;
return $this;
}
public function getMatricule(): ?string
{
return $this->matricule;
}
public function setMatricule(string $matricule): static
{
$this->matricule = $matricule;
return $this;
}
public function getBornLocation(): ?string
{
return $this->bornLocation;
}
public function setBornLocation(?string $bornLocation): static
{
$this->bornLocation = $bornLocation;
return $this;
}
public function getParent(): ?User
{
return $this->parent;
}
public function setParent(?User $parent): static
{
$this->parent = $parent;
return $this;
}
/**
* @return Collection<int, StudentYear>
*/
public function getStudentYears(): Collection
{
return $this->studentYears;
}
public function addStudentYear(StudentYear $studentYear): static
{
if (!$this->studentYears->contains($studentYear)) {
$this->studentYears->add($studentYear);
$studentYear->setStudent($this);
}
return $this;
}
public function removeStudentYear(StudentYear $studentYear): static
{
if ($this->studentYears->removeElement($studentYear)) {
// set the owning side to null (unless already changed)
if ($studentYear->getStudent() === $this) {
$studentYear->setStudent(null);
}
}
return $this;
}
/**
* @return Collection<int, Late>
*/
public function getLates(): Collection
{
return $this->lates;
}
public function addLate(Late $late): static
{
if (!$this->lates->contains($late)) {
$this->lates->add($late);
$late->setStudent($this);
}
return $this;
}
public function removeLate(Late $late): static
{
if ($this->lates->removeElement($late)) {
// set the owning side to null (unless already changed)
if ($late->getStudent() === $this) {
$late->setStudent(null);
}
}
return $this;
}
/**
* @return Collection<int, Absence>
*/
public function getAbsences(): Collection
{
return $this->absences;
}
public function addAbsence(Absence $absence): static
{
if (!$this->absences->contains($absence)) {
$this->absences->add($absence);
$absence->setStudent($this);
}
return $this;
}
public function removeAbsence(Absence $absence): static
{
if ($this->absences->removeElement($absence)) {
// set the owning side to null (unless already changed)
if ($absence->getStudent() === $this) {
$absence->setStudent(null);
}
}
return $this;
}
/**
* @return Collection<int, Note>
*/
public function getNotes(): Collection
{
return $this->notes;
}
public function addNote(Note $note): static
{
if (!$this->notes->contains($note)) {
$this->notes->add($note);
$note->setStudent($this);
}
return $this;
}
public function removeNote(Note $note): static
{
if ($this->notes->removeElement($note)) {
// set the owning side to null (unless already changed)
if ($note->getStudent() === $this) {
$note->setStudent(null);
}
}
return $this;
}
public function setFullName(?string $fullName): static
{
$this->fullName = $fullName;
return $this;
}
public function getEditor(): ?User
{
return $this->editor;
}
public function setEditor(?User $editor): static
{
$this->editor = $editor;
return $this;
}
/**
* @return Collection<int, Punish>
*/
public function getPunishes(): Collection
{
return $this->punishes;
}
public function addPunishes(Punish $punishDetail): static
{
if (!$this->punishes->contains($punishDetail)) {
$this->punishes->add($punishDetail);
$punishDetail->setStudent($this);
}
return $this;
}
public function removePunishDetail(Punish $punishes): static
{
if ($this->punishes->removeElement($punishes)) {
// set the owning side to null (unless already changed)
if ($punishes->getStudent() === $this) {
$punishes->setStudent(null);
}
}
return $this;
}
public function getAuthor(): ?User
{
return $this->author;
}
public function setAuthor(?User $author): static
{
$this->author = $author;
return $this;
}
public function getSexe(): ?string
{
return $this->sexe;
}
public function setSexe(string $sexe): static
{
$this->sexe = $sexe;
return $this;
}
public function getSchool(): ?School
{
return $this->school;
}
public function setSchool(?School $school): static
{
$this->school = $school;
return $this;
}
/**
* @return Collection<int, DisciplineWarning>
*/
public function getDisciplineWarnings(): Collection
{
return $this->disciplineWarnings;
}
public function addDisciplineWarning(DisciplineWarning $disciplineWarning): static
{
if (!$this->disciplineWarnings->contains($disciplineWarning)) {
$this->disciplineWarnings->add($disciplineWarning);
$disciplineWarning->setStudent($this);
}
return $this;
}
public function removeDisciplineWarning(DisciplineWarning $disciplineWarning): static
{
if ($this->disciplineWarnings->removeElement($disciplineWarning)) {
// set the owning side to null (unless already changed)
if ($disciplineWarning->getStudent() === $this) {
$disciplineWarning->setStudent(null);
}
}
return $this;
}
/**
* @return Collection<int, DisciplineBlame>
*/
public function getDisciplineBlames(): Collection
{
return $this->disciplineBlames;
}
public function addDisciplineBlame(DisciplineBlame $disciplineBlame): static
{
if (!$this->disciplineBlames->contains($disciplineBlame)) {
$this->disciplineBlames->add($disciplineBlame);
$disciplineBlame->setStudent($this);
}
return $this;
}
public function removeDisciplineBlame(DisciplineBlame $disciplineBlame): static
{
if ($this->disciplineBlames->removeElement($disciplineBlame)) {
// set the owning side to null (unless already changed)
if ($disciplineBlame->getStudent() === $this) {
$disciplineBlame->setStudent(null);
}
}
return $this;
}
/**
* @return Collection<int, DisciplineExclusion>
*/
public function getDisciplineExclusions(): Collection
{
return $this->disciplineExclusions;
}
public function addDisciplineExclusion(DisciplineExclusion $disciplineExclusion): static
{
if (!$this->disciplineExclusions->contains($disciplineExclusion)) {
$this->disciplineExclusions->add($disciplineExclusion);
$disciplineExclusion->setStudent($this);
}
return $this;
}
public function removeDisciplineExclusion(DisciplineExclusion $disciplineExclusion): static
{
if ($this->disciplineExclusions->removeElement($disciplineExclusion)) {
// set the owning side to null (unless already changed)
if ($disciplineExclusion->getStudent() === $this) {
$disciplineExclusion->setStudent(null);
}
}
return $this;
}
/**
* @return Collection<int, DisciplineRetained>
*/
public function getDisciplineRetaineds(): Collection
{
return $this->disciplineRetaineds;
}
public function addDisciplineRetained(DisciplineRetained $disciplineRetained): static
{
if (!$this->disciplineRetaineds->contains($disciplineRetained)) {
$this->disciplineRetaineds->add($disciplineRetained);
$disciplineRetained->setStudent($this);
}
return $this;
}
public function removeDisciplineRetained(DisciplineRetained $disciplineRetained): static
{
if ($this->disciplineRetaineds->removeElement($disciplineRetained)) {
// set the owning side to null (unless already changed)
if ($disciplineRetained->getStudent() === $this) {
$disciplineRetained->setStudent(null);
}
}
return $this;
}
public function getDefinitiveExclusion(): ?DefinitiveExclusion
{
return $this->definitiveExclusion;
}
public function setDefinitiveExclusion(DefinitiveExclusion $definitiveExclusion): static
{
// set the owning side of the relation if necessary
if ($definitiveExclusion->getStudent() !== $this) {
$definitiveExclusion->setStudent($this);
}
$this->definitiveExclusion = $definitiveExclusion;
return $this;
}
/**
* @return Collection<int, DisciplineConcile>
*/
public function getDisciplineConciles(): Collection
{
return $this->disciplineConciles;
}
public function addDisciplineConcile(DisciplineConcile $disciplineConcile): static
{
if (!$this->disciplineConciles->contains($disciplineConcile)) {
$this->disciplineConciles->add($disciplineConcile);
$disciplineConcile->setStudent($this);
}
return $this;
}
public function removeDisciplineConcile(DisciplineConcile $disciplineConcile): static
{
if ($this->disciplineConciles->removeElement($disciplineConcile)) {
// set the owning side to null (unless already changed)
if ($disciplineConcile->getStudent() === $this) {
$disciplineConcile->setStudent(null);
}
}
return $this;
}
/**
* @return Collection<int, PrimaryNote>
*/
public function getPrimaryNotes(): Collection
{
return $this->primaryNotes;
}
public function addPrimaryNote(PrimaryNote $primaryNote): static
{
if (!$this->primaryNotes->contains($primaryNote)) {
$this->primaryNotes->add($primaryNote);
$primaryNote->setStudent($this);
}
return $this;
}
public function removePrimaryNote(PrimaryNote $primaryNote): static
{
if ($this->primaryNotes->removeElement($primaryNote)) {
// set the owning side to null (unless already changed)
if ($primaryNote->getStudent() === $this) {
$primaryNote->setStudent(null);
}
}
return $this;
}
/**
* @return Collection<int, DisciplinePunish>
*/
public function getDisciplinePunishes(): Collection
{
return $this->disciplinePunishes;
}
public function addDisciplinePunish(DisciplinePunish $disciplinePunish): static
{
if (!$this->disciplinePunishes->contains($disciplinePunish)) {
$this->disciplinePunishes->add($disciplinePunish);
$disciplinePunish->setStudent($this);
}
return $this;
}
public function removeDisciplinePunish(DisciplinePunish $disciplinePunish): static
{
if ($this->disciplinePunishes->removeElement($disciplinePunish)) {
// set the owning side to null (unless already changed)
if ($disciplinePunish->getStudent() === $this) {
$disciplinePunish->setStudent(null);
}
}
return $this;
}
public function getPicture(): ?string
{
return $this->picture;
}
public function setPicture(?string $picture): static
{
$this->picture = $picture;
return $this;
}
public function getBornArrondissement(): ?string
{
return $this->bornArrondissement;
}
public function setBornArrondissement(?string $bornArrondissement): static
{
$this->bornArrondissement = $bornArrondissement;
return $this;
}
public function getBornDepartement(): ?string
{
return $this->bornDepartement;
}
public function setBornDepartement(?string $bornDepartement): static
{
$this->bornDepartement = $bornDepartement;
return $this;
}
/**
* @return Collection<int, Blame>
*/
public function getBlames(): Collection
{
return $this->blames;
}
public function addBlame(Blame $blame): static
{
if (!$this->blames->contains($blame)) {
$this->blames->add($blame);
$blame->setStudent($this);
}
return $this;
}
public function removeBlame(Blame $blame): static
{
if ($this->blames->removeElement($blame)) {
// set the owning side to null (unless already changed)
if ($blame->getStudent() === $this) {
$blame->setStudent(null);
}
}
return $this;
}
/**
* @return Collection<int, Warning>
*/
public function getWarnings(): Collection
{
return $this->warnings;
}
public function addWarning(Warning $warning): static
{
if (!$this->warnings->contains($warning)) {
$this->warnings->add($warning);
$warning->setStudent($this);
}
return $this;
}
public function removeWarning(Warning $warning): static
{
if ($this->warnings->removeElement($warning)) {
// set the owning side to null (unless already changed)
if ($warning->getStudent() === $this) {
$warning->setStudent(null);
}
}
return $this;
}
/**
* @return Collection<int, Retained>
*/
public function getRetaineds(): Collection
{
return $this->retaineds;
}
public function addRetained(Retained $retained): static
{
if (!$this->retaineds->contains($retained)) {
$this->retaineds->add($retained);
$retained->setStudent($this);
}
return $this;
}
public function removeRetained(Retained $retained): static
{
if ($this->retaineds->removeElement($retained)) {
// set the owning side to null (unless already changed)
if ($retained->getStudent() === $this) {
$retained->setStudent(null);
}
}
return $this;
}
public function getFather(): ?string
{
return $this->father;
}
public function setFather(?string $father): static
{
$this->father = $father;
return $this;
}
public function getMother(): ?string
{
return $this->mother;
}
public function setMother(?string $mother): static
{
$this->mother = $mother;
return $this;
}
public function getBornDay(): ?\DateTimeInterface
{
return $this->bornDay;
}
public function setBornDay(?\DateTimeInterface $bornDay): static
{
$this->bornDay = $bornDay;
return $this;
}
public function getGovMatricule(): ?string
{
return $this->govMatricule;
}
public function setGovMatricule(?string $govMatricule): static
{
$this->govMatricule = $govMatricule;
return $this;
}
}