<?php
namespace App\Entity;
use App\Repository\LMSContentRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=LMSContentRepository::class)
* @Vich\Uploadable
*/
class LMSContent
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="integer")
*/
private $seqnum;
/**
* @ORM\Column(type="string", length=255)
*/
private $title;
/**
* @ORM\Column(type="string", length=255)
*/
private $category;
/**
* @ORM\Column(type="string", length=255)
*/
private $type;
/**
* @ORM\Column(type="integer")
*/
private $duration;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $content;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $link;
/**
* NOTE: This is not a mapped field of entity metadata, just a simple property.
*
* @Vich\UploadableField(mapping="lmspdf", fileNameProperty="pdf")
* @Assert\File(
* mimeTypes = {"application/pdf", "application/x-pdf"},
* mimeTypesMessage = "Wrong file type (pdf)"
* )
*
* @var File|null
*/
private $pdfFile;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $pdf;
/**
* @ORM\Column(type="datetime", nullable=true)
*
* @var \DateTimeInterface|null
*/
private $updatedAt;
/**
* @ORM\ManyToMany(targetEntity=LMSExercise::class, mappedBy="lmsContents")
* @ORM\JoinColumn(nullable=true)
*/
private $lMSExercises;
/**
* @ORM\ManyToMany(targetEntity=User::class, inversedBy="lMSContents")
*/
private $userProgression;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\ManyToMany(targetEntity=LMSSurvey::class, inversedBy="lMSContents", cascade={"persist"})
*/
private $LMSSurveys;
/**
* @ORM\ManyToOne(targetEntity=LMSSequence::class, inversedBy="lmsContents")
*/
private $lMSSequence;
public function __construct()
{
$this->lMSExercises = new ArrayCollection();
$this->userProgression = new ArrayCollection();
$this->LMSSurveys = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getSeqnum(): ?int
{
return $this->seqnum;
}
public function setSeqnum(int $seqnum): self
{
$this->seqnum = $seqnum;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getCategory(): ?string
{
return $this->category;
}
public function setCategory(string $category): self
{
$this->category = $category;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
public function getDuration(): ?int
{
return $this->duration;
}
public function setDuration(int $duration): self
{
$this->duration = $duration;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): self
{
$this->content = $content;
return $this;
}
public function getLink(): ?string
{
return $this->link;
}
public function setLink(?string $link): self
{
$this->link = $link;
return $this;
}
/**
* If manually uploading a file (i.e. not using Symfony Form) ensure an instance
* of 'UploadedFile' is injected into this setter to trigger the update. If this
* bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
* must be able to accept an instance of 'File' as the bundle will inject one here
* during Doctrine hydration.
*
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $lessonFile
*/
public function setPdfFile(?File $pdfFile = null): void
{
$this->pdfFile = $pdfFile;
if (null !== $pdfFile) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updatedAt = new \DateTimeImmutable();
}
}
public function getPdfFile(): ?File
{
return $this->pdfFile;
}
public function setPdf(?string $pdf): void
{
$this->pdf = $pdf;
}
public function getPdf(): ?string
{
return $this->pdf;
}
/**
* @return Collection<int, LMSExercise>
*/
public function getLMSExercises(): Collection
{
return $this->lMSExercises;
}
public function addLMSExercise(LMSExercise $lMSExercise): self
{
if (!$this->lMSExercises->contains($lMSExercise)) {
$this->lMSExercises[] = $lMSExercise;
$lMSExercise->addLmsContent($this);
}
return $this;
}
public function removeLMSExercise(LMSExercise $lMSExercise): self
{
if ($this->lMSExercises->removeElement($lMSExercise)) {
$lMSExercise->removeLmsContent($this);
}
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUserProgression(): Collection
{
return $this->userProgression;
}
public function addUserProgression(User $userProgression): self
{
if (!$this->userProgression->contains($userProgression)) {
$this->userProgression[] = $userProgression;
}
return $this;
}
public function removeUserProgression(User $userProgression): self
{
$this->userProgression->removeElement($userProgression);
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return Collection<int, LMSSurvey>
*/
public function getLMSSurveys(): Collection
{
return $this->LMSSurveys;
}
public function addLMSSurvey(LMSSurvey $lMSSurvey): self
{
if (!$this->LMSSurveys->contains($lMSSurvey)) {
$this->LMSSurveys[] = $lMSSurvey;
}
return $this;
}
public function removeLMSSurvey(LMSSurvey $lMSSurvey): self
{
$this->LMSSurveys->removeElement($lMSSurvey);
return $this;
}
public function getLMSSequence(): ?LMSSequence
{
return $this->lMSSequence;
}
public function setLMSSequence(?LMSSequence $lMSSequence): self
{
$this->lMSSequence = $lMSSequence;
return $this;
}
}