src/Entity/Lesson.php line 14

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\LessonRepository;
  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. #[ORM\Entity(repositoryClassLessonRepository::class)]
  10. #[ApiResource]
  11. class Lesson
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $name null;
  19.     #[ORM\Column(typeTypes::TEXT)]
  20.     private ?string $description 'Beschreibung';
  21.     #[ORM\Column]
  22.     private ?int $sequence null;
  23.     #[ORM\Column]
  24.     private ?bool $isChallenge null;
  25.     #[ORM\ManyToOne(inversedBy'lessons')]
  26.     private ?Course $course null;
  27.     #[ORM\ManyToMany(targetEntityMediaObject::class, inversedBy'lessons')]
  28.     private Collection $assets;
  29.     #[ORM\OneToMany(mappedBy'lesson'targetEntityLessonProgress::class)]
  30.     private Collection $lessonProgress;
  31.     #[ORM\Column(length255)]
  32.     private ?string $type null;
  33.     #[ORM\ManyToOne(inversedBy'lessons')]
  34.     private ?Quiz $quiz null;
  35.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  36.     private ?\DateTimeInterface $deadline null;
  37.     #[ORM\ManyToOne(inversedBy'lessons')]
  38.     private ?Badge $badge null;
  39.     #[ORM\ManyToOne(inversedBy'articulateLesson')]
  40.     private ?MediaObject $articulate null;
  41.     #[ORM\Column(length255nullabletrue)]
  42.     private ?string $liveLink null;
  43.     public function __construct()
  44.     {
  45.         $this->assets = new ArrayCollection();
  46.         $this->lessonProgress = new ArrayCollection();
  47.     }
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function __toString(): string
  53.     {
  54.         return $this->name;
  55.     }
  56.     public function getName(): ?string
  57.     {
  58.         return $this->name;
  59.     }
  60.     public function setName(string $name): self
  61.     {
  62.         $this->name $name;
  63.         return $this;
  64.     }
  65.     public function getDescription(): ?string
  66.     {
  67.         return $this->description;
  68.     }
  69.     public function setDescription(?string $description): self
  70.     {
  71.         $this->description $description;
  72.         return $this;
  73.     }
  74.     public function getSequence(): ?int
  75.     {
  76.         return $this->sequence;
  77.     }
  78.     public function setSequence(int $sequence): self
  79.     {
  80.         $this->sequence $sequence;
  81.         return $this;
  82.     }
  83.     public function isIsChallenge(): ?bool
  84.     {
  85.         return $this->isChallenge;
  86.     }
  87.     public function setIsChallenge(bool $isChallenge): self
  88.     {
  89.         $this->isChallenge $isChallenge;
  90.         return $this;
  91.     }
  92.     public function getCourse(): ?Course
  93.     {
  94.         return $this->course;
  95.     }
  96.     public function setCourse(?Course $course): self
  97.     {
  98.         $this->course $course;
  99.         return $this;
  100.     }
  101.     /**
  102.      * @return Collection<int, MediaObject>
  103.      */
  104.     public function getAssets(): Collection
  105.     {
  106.         return $this->assets;
  107.     }
  108.     public function addAsset(MediaObject $asset): self
  109.     {
  110.         if (!$this->assets->contains($asset)) {
  111.             $this->assets->add($asset);
  112.         }
  113.         return $this;
  114.     }
  115.     public function removeAsset(MediaObject $asset): self
  116.     {
  117.         $this->assets->removeElement($asset);
  118.         return $this;
  119.     }
  120.     /**
  121.      * @return Collection<int, LessonProgress>
  122.      */
  123.     public function getLessonProgress(): Collection
  124.     {
  125.         return $this->lessonProgress;
  126.     }
  127.     public function addLessonProgress(LessonProgress $lessonProgress): self
  128.     {
  129.         if (!$this->lessonProgress->contains($lessonProgress)) {
  130.             $this->lessonProgress->add($lessonProgress);
  131.             $lessonProgress->setLesson($this);
  132.         }
  133.         return $this;
  134.     }
  135.     public function removeLessonProgress(LessonProgress $lessonProgress): self
  136.     {
  137.         if ($this->lessonProgress->removeElement($lessonProgress)) {
  138.             // set the owning side to null (unless already changed)
  139.             if ($lessonProgress->getLesson() === $this) {
  140.                 $lessonProgress->setLesson(null);
  141.             }
  142.         }
  143.         return $this;
  144.     }
  145.     public function getType(): ?string
  146.     {
  147.         return $this->type;
  148.     }
  149.     public function setType(string $type): self
  150.     {
  151.         $this->type $type;
  152.         return $this;
  153.     }
  154.     public function getQuiz(): ?Quiz
  155.     {
  156.         return $this->quiz;
  157.     }
  158.     public function setQuiz(?Quiz $quiz): self
  159.     {
  160.         $this->quiz $quiz;
  161.         return $this;
  162.     }
  163.     public function getDeadline(): ?\DateTimeInterface
  164.     {
  165.         return $this->deadline;
  166.     }
  167.     public function setDeadline(?\DateTimeInterface $deadline): self
  168.     {
  169.         $this->deadline $deadline;
  170.         return $this;
  171.     }
  172.     public function getBadge(): ?Badge
  173.     {
  174.         return $this->badge;
  175.     }
  176.     public function setBadge(?Badge $badge): self
  177.     {
  178.         $this->badge $badge;
  179.         return $this;
  180.     }
  181.     public function getArticulate(): ?MediaObject
  182.     {
  183.         return $this->articulate;
  184.     }
  185.     public function setArticulate(?MediaObject $articulate): self
  186.     {
  187.         $this->articulate $articulate;
  188.         return $this;
  189.     }
  190.     public function getLiveLink(): ?string
  191.     {
  192.         return $this->liveLink;
  193.     }
  194.     public function setLiveLink(string $liveLink): self
  195.     {
  196.         $this->liveLink $liveLink;
  197.         return $this;
  198.     }
  199. }