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(length255nullabletrue)]
  40.     #[Groups(['homework'])]
  41.     private ?string $correctionDate null;
  42.     #[Groups(['homework'])]
  43.     #[ORM\ManyToOne(inversedBy'homeWorks'cascade: ["persist"])]
  44.     private ?User $author null;
  45.     #[ORM\ManyToOne(inversedBy'homeworksEdited'cascade: ["persist"])]
  46.     private ?User $editor null;
  47.     #[ORM\ManyToOne(inversedBy'homeWorks'cascade: ["persist"])]
  48.     private ?School $school null;
  49.     #[ORM\OneToMany(mappedBy'homework'targetEntityHomeworkBookmark::class)]
  50.     private Collection $homeworkBookmarks;
  51.     public function __construct()
  52.     {
  53.         $this->homeWorkYears = new ArrayCollection();
  54.         $this->homeworkBookmarks = new ArrayCollection();
  55.     }
  56.     public function getId(): ?int
  57.     {
  58.         return $this->id;
  59.     }
  60.     public function getContent(): ?string
  61.     {
  62.         return $this->content;
  63.     }
  64.     public function setContent(string $content): static
  65.     {
  66.         $this->content $content;
  67.         return $this;
  68.     }
  69.     public function isInBook(): ?bool
  70.     {
  71.         return $this->inBook;
  72.     }
  73.     public function setInBook(?bool $inBook): static
  74.     {
  75.         $this->inBook $inBook;
  76.         return $this;
  77.     }
  78.     public function getFileName(): ?string
  79.     {
  80.         return $this->fileName;
  81.     }
  82.     public function setFileName(?string $fileName): static
  83.     {
  84.         $this->fileName $fileName;
  85.         return $this;
  86.     }
  87.     public function getSubject(): ?Subject
  88.     {
  89.         return $this->subject;
  90.     }
  91.     public function setSubject(?Subject $subject): static
  92.     {
  93.         $this->subject $subject;
  94.         return $this;
  95.     }
  96.     public function getClasse(): ?TheClass
  97.     {
  98.         return $this->classe;
  99.     }
  100.     public function setClasse(?TheClass $classe): static
  101.     {
  102.         $this->classe $classe;
  103.         return $this;
  104.     }
  105.     public function getYear(): ?SchoolYear
  106.     {
  107.         return $this->year;
  108.     }
  109.     public function setYear(?SchoolYear $year): static
  110.     {
  111.         $this->year $year;
  112.         return $this;
  113.     }
  114.     public function getCorrectionDate(): ?String
  115.     {
  116.         return $this->correctionDate;
  117.     }
  118.     public function setCorrectionDate(?String $correctionDate): static
  119.     {
  120.         $this->correctionDate $correctionDate;
  121.         return $this;
  122.     }
  123.     public function getAuthor(): ?User
  124.     {
  125.         return $this->author;
  126.     }
  127.     public function setAuthor(?User $author): static
  128.     {
  129.         $this->author $author;
  130.         return $this;
  131.     }
  132.     public function getEditor(): ?User
  133.     {
  134.         return $this->editor;
  135.     }
  136.     public function setEditor(?User $editor): static
  137.     {
  138.         $this->editor $editor;
  139.         return $this;
  140.     }
  141.     public function getSchool(): ?School
  142.     {
  143.         return $this->school;
  144.     }
  145.     public function setSchool(?School $school): static
  146.     {
  147.         $this->school $school;
  148.         return $this;
  149.     }
  150.     /**
  151.      * @return Collection<int, HomeworkBookmark>
  152.      */
  153.     public function getHomeworkBookmarks(): Collection
  154.     {
  155.         return $this->homeworkBookmarks;
  156.     }
  157.     public function addHomeworkBookmark(HomeworkBookmark $homeworkBookmark): static
  158.     {
  159.         if (!$this->homeworkBookmarks->contains($homeworkBookmark)) {
  160.             $this->homeworkBookmarks->add($homeworkBookmark);
  161.             $homeworkBookmark->setHomework($this);
  162.         }
  163.         return $this;
  164.     }
  165.     public function removeHomeworkBookmark(HomeworkBookmark $homeworkBookmark): static
  166.     {
  167.         if ($this->homeworkBookmarks->removeElement($homeworkBookmark)) {
  168.             // set the owning side to null (unless already changed)
  169.             if ($homeworkBookmark->getHomework() === $this) {
  170.                 $homeworkBookmark->setHomework(null);
  171.             }
  172.         }
  173.         return $this;
  174.     }
  175. }