src/Entity/HomeWork.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\Timestampable;
  4. use App\Repository\HomeWorkRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use JMS\Serializer\Annotation\Groups;
  10. #[ORM\Table(name"home_work")]
  11. #[ORM\Index(columns: ["content"], name"home_work",flags: ['fulltext'])]
  12. #[ORM\HasLifecycleCallbacks]
  13. #[ORM\Entity(repositoryClassHomeWorkRepository::class)]
  14. class HomeWork
  15. {
  16.     use Timestampable;
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column]
  20.     #[Groups(['homework'])]
  21.     private ?int $id null;
  22.     #[ORM\Column(typeTypes::TEXT,nullabletrue)]
  23.     #[Groups(['homework'])]
  24.     private ?string $content null;
  25.     #[ORM\Column(nullabletrue)]
  26.     private ?bool $inBook null;
  27.     #[ORM\Column(length255nullabletrue)]
  28.     #[Groups(['homework'])]
  29.     private ?string $fileName null;
  30.     #[ORM\ManyToOne(inversedBy'homeWorks'cascade: ["persist"])]
  31.     #[Groups(['homework'])]
  32.     private ?Subject $subject null;
  33.     #[ORM\ManyToOne(inversedBy'homeWorks'cascade: ["persist"])]
  34.     #[Groups(['homework'])]
  35.     private ?TheClass $classe null;
  36.     #[ORM\ManyToOne(inversedBy'homeWorks'cascade: ["persist"])]
  37.     #[ORM\JoinColumn(nullablefalse)]
  38.     private ?SchoolYear $year null;
  39.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  40.     #[Groups(['homework'])]
  41.     private ?\DateTimeInterface $correctionDate null;
  42.     #[ORM\ManyToOne(inversedBy'homeWorks'cascade: ["persist"])]
  43.     private ?User $author null;
  44.     #[ORM\ManyToOne(inversedBy'homeworksEdited'cascade: ["persist"])]
  45.     private ?User $editor null;
  46.     #[ORM\ManyToOne(inversedBy'homeWorks'cascade: ["persist"])]
  47.     private ?School $school null;
  48.     #[ORM\OneToMany(mappedBy'homework'targetEntityHomeworkBookmark::class)]
  49.     private Collection $homeworkBookmarks;
  50.     public function __construct()
  51.     {
  52.         $this->homeworkBookmarks = new ArrayCollection();
  53.     }
  54.     public function getId(): ?int
  55.     {
  56.         return $this->id;
  57.     }
  58.     public function getContent(): ?string
  59.     {
  60.         return $this->content;
  61.     }
  62.     public function setContent(string $content): static
  63.     {
  64.         $this->content $content;
  65.         return $this;
  66.     }
  67.     public function isInBook(): ?bool
  68.     {
  69.         return $this->inBook;
  70.     }
  71.     public function setInBook(?bool $inBook): static
  72.     {
  73.         $this->inBook $inBook;
  74.         return $this;
  75.     }
  76.     public function getFileName(): ?string
  77.     {
  78.         return $this->fileName;
  79.     }
  80.     public function setFileName(?string $fileName): static
  81.     {
  82.         $this->fileName $fileName;
  83.         return $this;
  84.     }
  85.     public function getSubject(): ?Subject
  86.     {
  87.         return $this->subject;
  88.     }
  89.     public function setSubject(?Subject $subject): static
  90.     {
  91.         $this->subject $subject;
  92.         return $this;
  93.     }
  94.     public function getClasse(): ?TheClass
  95.     {
  96.         return $this->classe;
  97.     }
  98.     public function setClasse(?TheClass $classe): static
  99.     {
  100.         $this->classe $classe;
  101.         return $this;
  102.     }
  103.     public function getYear(): ?SchoolYear
  104.     {
  105.         return $this->year;
  106.     }
  107.     public function setYear(?SchoolYear $year): static
  108.     {
  109.         $this->year $year;
  110.         return $this;
  111.     }
  112.     public function getCorrectionDate(): ?\DateTimeInterface
  113.     {
  114.         return $this->correctionDate;
  115.     }
  116.     public function setCorrectionDate(\DateTimeInterface $correctionDate): static
  117.     {
  118.         $this->correctionDate $correctionDate;
  119.         return $this;
  120.     }
  121.     public function getAuthor(): ?User
  122.     {
  123.         return $this->author;
  124.     }
  125.     public function setAuthor(?User $author): static
  126.     {
  127.         $this->author $author;
  128.         return $this;
  129.     }
  130.     public function getEditor(): ?User
  131.     {
  132.         return $this->editor;
  133.     }
  134.     public function setEditor(?User $editor): static
  135.     {
  136.         $this->editor $editor;
  137.         return $this;
  138.     }
  139.     public function getSchool(): ?School
  140.     {
  141.         return $this->school;
  142.     }
  143.     public function setSchool(?School $school): static
  144.     {
  145.         $this->school $school;
  146.         return $this;
  147.     }
  148.     /**
  149.      * @return Collection<int, HomeworkBookmark>
  150.      */
  151.     public function getHomeworkBookmarks(): Collection
  152.     {
  153.         return $this->homeworkBookmarks;
  154.     }
  155.     public function addHomeworkBookmark(HomeworkBookmark $homeworkBookmark): static
  156.     {
  157.         if (!$this->homeworkBookmarks->contains($homeworkBookmark)) {
  158.             $this->homeworkBookmarks->add($homeworkBookmark);
  159.             $homeworkBookmark->setHomework($this);
  160.         }
  161.         return $this;
  162.     }
  163.     public function removeHomeworkBookmark(HomeworkBookmark $homeworkBookmark): static
  164.     {
  165.         if ($this->homeworkBookmarks->removeElement($homeworkBookmark)) {
  166.             // set the owning side to null (unless already changed)
  167.             if ($homeworkBookmark->getHomework() === $this) {
  168.                 $homeworkBookmark->setHomework(null);
  169.             }
  170.         }
  171.         return $this;
  172.     }
  173. }