src/Entity/Scolarity.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ScolarityRepository;
  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 JMS\Serializer\Annotation\Groups;
  9. #[ORM\Entity(repositoryClassScolarityRepository::class)]
  10. class Scolarity
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     #[Groups(['getScolarity''getScolarityHistory'])]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255)]
  18.     #[Groups(['getScolarity''getScolarityHistory'])]
  19.     private ?string $name null;
  20.     #[ORM\ManyToOne(inversedBy'scolarities'cascade: ["persist"])]
  21.     #[ORM\JoinColumn(nullablefalse)]
  22.     #[Groups(['getScolarity'])]
  23.     private ?TheClass $classe null;
  24.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  25.     #[Groups(['getScolarity'])]
  26.     private ?\DateTimeInterface $endAt null;
  27.     #[ORM\ManyToOne(inversedBy'scolarities'cascade: ["persist"])]
  28.     #[ORM\JoinColumn(nullablefalse)]
  29.     private ?SchoolYear $year null;
  30.     #[ORM\ManyToOne(inversedBy'scolarities'cascade: ["persist"])]
  31.     #[ORM\JoinColumn(nullablefalse)]
  32.     private ?User $author null;
  33.     #[ORM\OneToMany(mappedBy'scolarity'targetEntityStudentScolarity::class)]
  34.     private Collection $studentScolarities;
  35.     #[ORM\OneToMany(mappedBy'scolarity'targetEntityStudentYear::class)]
  36.     private Collection $students;
  37.     #[ORM\Column(type'boolean')]
  38.     #[Groups(['getScolarity'])]
  39.     private ?bool $isExams false;
  40.     #[ORM\Column]
  41.     #[Groups(['getScolarity'])]
  42.     private ?int $amount null;
  43.     #[ORM\ManyToOne(inversedBy'scolarities')]
  44.     private ?School $school null;
  45.     public function __construct()
  46.     {
  47.         $this->studentScolarities = new ArrayCollection();
  48.         $this->students = new ArrayCollection();
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getName(): ?string
  55.     {
  56.         return $this->name;
  57.     }
  58.     public function setName(string $name): static
  59.     {
  60.         $this->name $name;
  61.         return $this;
  62.     }
  63.     public function getClasse(): ?TheClass
  64.     {
  65.         return $this->classe;
  66.     }
  67.     public function setClasse(?TheClass $classe): static
  68.     {
  69.         $this->classe $classe;
  70.         return $this;
  71.     }
  72.     public function getEndAt(): ?\DateTimeInterface
  73.     {
  74.         return $this->endAt;
  75.     }
  76.     public function setEndAt(\DateTimeInterface $endAt): static
  77.     {
  78.         $this->endAt $endAt;
  79.         return $this;
  80.     }
  81.     public function getYear(): ?SchoolYear
  82.     {
  83.         return $this->year;
  84.     }
  85.     public function setYear(?SchoolYear $year): static
  86.     {
  87.         $this->year $year;
  88.         return $this;
  89.     }
  90.     public function getAuthor(): ?User
  91.     {
  92.         return $this->author;
  93.     }
  94.     public function setAuthor(?User $author): static
  95.     {
  96.         $this->author $author;
  97.         return $this;
  98.     }
  99.     /**
  100.      * @return Collection<int, StudentScolarity>
  101.      */
  102.     public function getStudentScolarities(): Collection
  103.     {
  104.         return $this->studentScolarities;
  105.     }
  106.     public function addStudentScolarity(StudentScolarity $studentScolarity): static
  107.     {
  108.         if (!$this->studentScolarities->contains($studentScolarity)) {
  109.             $this->studentScolarities->add($studentScolarity);
  110.             $studentScolarity->setScolarity($this);
  111.         }
  112.         return $this;
  113.     }
  114.     public function removeStudentScolarity(StudentScolarity $studentScolarity): static
  115.     {
  116.         if ($this->studentScolarities->removeElement($studentScolarity)) {
  117.             // set the owning side to null (unless already changed)
  118.             if ($studentScolarity->getScolarity() === $this) {
  119.                 $studentScolarity->setScolarity(null);
  120.             }
  121.         }
  122.         return $this;
  123.     }
  124.     /**
  125.      * @return Collection<int, StudentYear>
  126.      */
  127.     public function getStudents(): Collection
  128.     {
  129.         return $this->students;
  130.     }
  131.     public function addStudent(StudentYear $student): static
  132.     {
  133.         if (!$this->students->contains($student)) {
  134.             $this->students->add($student);
  135.             $student->setScolarity($this);
  136.         }
  137.         return $this;
  138.     }
  139.     public function removeStudent(StudentYear $student): static
  140.     {
  141.         if ($this->students->removeElement($student)) {
  142.             // set the owning side to null (unless already changed)
  143.             if ($student->getScolarity() === $this) {
  144.                 $student->setScolarity(null);
  145.             }
  146.         }
  147.         return $this;
  148.     }
  149.     public function isIsExams(): ?bool
  150.     {
  151.         return $this->isExams;
  152.     }
  153.     public function setIsExams(?bool $isExams): static
  154.     {
  155.         $this->isExams $isExams;
  156.         return $this;
  157.     }
  158.     public function getAmount(): ?int
  159.     {
  160.         return $this->amount;
  161.     }
  162.     public function setAmount(int $amount): static
  163.     {
  164.         $this->amount $amount;
  165.         return $this;
  166.     }
  167.     public function getSchool(): ?School
  168.     {
  169.         return $this->school;
  170.     }
  171.     public function setSchool(?School $school): static
  172.     {
  173.         $this->school $school;
  174.         return $this;
  175.     }
  176. }