src/Entity/LMSContent.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LMSContentRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. /**
  11.  * @ORM\Entity(repositoryClass=LMSContentRepository::class)
  12.  * @Vich\Uploadable
  13.  */
  14. class LMSContent
  15. {
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $seqnum;
  26.     /**
  27.      * @ORM\Column(type="string", length=255)
  28.      */
  29.     private $title;
  30.     /**
  31.      * @ORM\Column(type="string", length=255)
  32.      */
  33.     private $category;
  34.     /**
  35.      * @ORM\Column(type="string", length=255)
  36.      */
  37.     private $type;
  38.     /**
  39.      * @ORM\Column(type="integer")
  40.      */
  41.     private $duration;
  42.     /**
  43.      * @ORM\Column(type="text", nullable=true)
  44.      */
  45.     private $content;
  46.     /**
  47.      * @ORM\Column(type="text", nullable=true)
  48.      */
  49.     private $link;
  50.     /**
  51.      * NOTE: This is not a mapped field of entity metadata, just a simple property.
  52.      * 
  53.      * @Vich\UploadableField(mapping="lmspdf", fileNameProperty="pdf")
  54.      * @Assert\File(
  55.      *   mimeTypes = {"application/pdf", "application/x-pdf"},
  56.      *   mimeTypesMessage = "Wrong file type (pdf)"
  57.      * )
  58.      * 
  59.      * @var File|null
  60.      */
  61.     private $pdfFile;
  62.     /**
  63.      * @ORM\Column(type="string", length=255, nullable=true)
  64.      */
  65.     private $pdf;
  66.     /**
  67.      * @ORM\Column(type="datetime", nullable=true)
  68.      *
  69.      * @var \DateTimeInterface|null
  70.      */
  71.     private $updatedAt;
  72.     /**
  73.      * @ORM\ManyToMany(targetEntity=LMSExercise::class, mappedBy="lmsContents")
  74.      * @ORM\JoinColumn(nullable=true)
  75.      */
  76.     private $lMSExercises;
  77.     /**
  78.      * @ORM\ManyToMany(targetEntity=User::class, inversedBy="lMSContents")
  79.      */
  80.     private $userProgression;
  81.     /**
  82.      * @ORM\Column(type="text", nullable=true)
  83.      */
  84.     private $description;
  85.     /**
  86.      * @ORM\ManyToMany(targetEntity=LMSSurvey::class, inversedBy="lMSContents", cascade={"persist"})
  87.      */
  88.     private $LMSSurveys;
  89.     /**
  90.      * @ORM\ManyToOne(targetEntity=LMSSequence::class, inversedBy="lmsContents")
  91.      */
  92.     private $lMSSequence;
  93.     public function __construct()
  94.     {
  95.         $this->lMSExercises = new ArrayCollection();
  96.         $this->userProgression = new ArrayCollection();
  97.         $this->LMSSurveys = new ArrayCollection();
  98.     }
  99.     public function getId(): ?int
  100.     {
  101.         return $this->id;
  102.     }
  103.     public function getSeqnum(): ?int
  104.     {
  105.         return $this->seqnum;
  106.     }
  107.     public function setSeqnum(int $seqnum): self
  108.     {
  109.         $this->seqnum $seqnum;
  110.         return $this;
  111.     }
  112.     public function getTitle(): ?string
  113.     {
  114.         return $this->title;
  115.     }
  116.     public function setTitle(string $title): self
  117.     {
  118.         $this->title $title;
  119.         return $this;
  120.     }
  121.     public function getCategory(): ?string
  122.     {
  123.         return $this->category;
  124.     }
  125.     public function setCategory(string $category): self
  126.     {
  127.         $this->category $category;
  128.         return $this;
  129.     }
  130.     public function getType(): ?string
  131.     {
  132.         return $this->type;
  133.     }
  134.     public function setType(string $type): self
  135.     {
  136.         $this->type $type;
  137.         return $this;
  138.     }
  139.     public function getDuration(): ?int
  140.     {
  141.         return $this->duration;
  142.     }
  143.     public function setDuration(int $duration): self
  144.     {
  145.         $this->duration $duration;
  146.         return $this;
  147.     }
  148.     public function getContent(): ?string
  149.     {
  150.         return $this->content;
  151.     }
  152.     public function setContent(?string $content): self
  153.     {
  154.         $this->content $content;
  155.         return $this;
  156.     }
  157.     public function getLink(): ?string
  158.     {
  159.         return $this->link;
  160.     }
  161.     public function setLink(?string $link): self
  162.     {
  163.         $this->link $link;
  164.         return $this;
  165.     }
  166.     /**
  167.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  168.      * of 'UploadedFile' is injected into this setter to trigger the update. If this
  169.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  170.      * must be able to accept an instance of 'File' as the bundle will inject one here
  171.      * during Doctrine hydration.
  172.      *
  173.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $lessonFile
  174.      */
  175.     public function setPdfFile(?File $pdfFile null): void
  176.     {
  177.         $this->pdfFile $pdfFile;
  178.         if (null !== $pdfFile) {
  179.             // It is required that at least one field changes if you are using doctrine
  180.             // otherwise the event listeners won't be called and the file is lost
  181.             $this->updatedAt = new \DateTimeImmutable();
  182.         }
  183.     }
  184.     public function getPdfFile(): ?File
  185.     {
  186.         return $this->pdfFile;
  187.     }
  188.     public function setPdf(?string $pdf): void
  189.     {
  190.         $this->pdf $pdf;
  191.     }
  192.     public function getPdf(): ?string
  193.     {
  194.         return $this->pdf;
  195.     }
  196.     /**
  197.      * @return Collection<int, LMSExercise>
  198.      */
  199.     public function getLMSExercises(): Collection
  200.     {
  201.         return $this->lMSExercises;
  202.     }
  203.     public function addLMSExercise(LMSExercise $lMSExercise): self
  204.     {
  205.         if (!$this->lMSExercises->contains($lMSExercise)) {
  206.             $this->lMSExercises[] = $lMSExercise;
  207.             $lMSExercise->addLmsContent($this);
  208.         }
  209.         return $this;
  210.     }
  211.     public function removeLMSExercise(LMSExercise $lMSExercise): self
  212.     {
  213.         if ($this->lMSExercises->removeElement($lMSExercise)) {
  214.             $lMSExercise->removeLmsContent($this);
  215.         }
  216.         return $this;
  217.     }
  218.     /**
  219.      * @return Collection<int, User>
  220.      */
  221.     public function getUserProgression(): Collection
  222.     {
  223.         return $this->userProgression;
  224.     }
  225.     public function addUserProgression(User $userProgression): self
  226.     {
  227.         if (!$this->userProgression->contains($userProgression)) {
  228.             $this->userProgression[] = $userProgression;
  229.         }
  230.         return $this;
  231.     }
  232.     public function removeUserProgression(User $userProgression): self
  233.     {
  234.         $this->userProgression->removeElement($userProgression);
  235.         return $this;
  236.     }
  237.     public function getDescription(): ?string
  238.     {
  239.         return $this->description;
  240.     }
  241.     public function setDescription(?string $description): self
  242.     {
  243.         $this->description $description;
  244.         return $this;
  245.     }
  246.     /**
  247.      * @return Collection<int, LMSSurvey>
  248.      */
  249.     public function getLMSSurveys(): Collection
  250.     {
  251.         return $this->LMSSurveys;
  252.     }
  253.     public function addLMSSurvey(LMSSurvey $lMSSurvey): self
  254.     {
  255.         if (!$this->LMSSurveys->contains($lMSSurvey)) {
  256.             $this->LMSSurveys[] = $lMSSurvey;
  257.         }
  258.         return $this;
  259.     }
  260.     public function removeLMSSurvey(LMSSurvey $lMSSurvey): self
  261.     {
  262.         $this->LMSSurveys->removeElement($lMSSurvey);
  263.         return $this;
  264.     }
  265.     public function getLMSSequence(): ?LMSSequence
  266.     {
  267.         return $this->lMSSequence;
  268.     }
  269.     public function setLMSSequence(?LMSSequence $lMSSequence): self
  270.     {
  271.         $this->lMSSequence $lMSSequence;
  272.         return $this;
  273.     }
  274. }