Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
web
/
vhosts
/
www.coaching-en-developpement-personnel.fr
/
htdocs
/
src
/
Entity
/
/srv/data/web/vhosts/www.coaching-en-developpement-personnel.fr/htdocs/src/Entity/Chapter.php
<?php namespace App\Entity; use Doctrine\ORM\Mapping as ORM; use App\Repository\ChapterRepository; use Doctrine\Common\Collections\Collection; use Symfony\Component\HttpFoundation\File\File; use Doctrine\Common\Collections\ArrayCollection; use Vich\UploaderBundle\Mapping\Annotation as Vich; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * @ORM\Entity(repositoryClass=ChapterRepository::class) * @Vich\Uploadable */ class Chapter { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $movieName; /** * NOTE: This is not a mapped field of entity metadata, just a simple property. * * @Vich\UploadableField(mapping="chapter_audio", fileNameProperty="audioName") * @var File|null */ private $audioFile; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $audioName; /** * NOTE: This is not a mapped field of entity metadata, just a simple property. * * @Vich\UploadableField(mapping="chapter_pdf", fileNameProperty="pdfName") * @Assert\File( * maxSize = "4048k", * mimeTypes = {"application/pdf", "application/x-pdf"}, * mimeTypesMessage = "Veuillez télécharger un PDF valide" * ) * @var File|null */ private $pdfFile; /** * NOTE: This is not a mapped field of entity metadata, just a simple property. * * @Vich\UploadableField(mapping="chapter_image", fileNameProperty="imageName") * * @var File */ private $imageFile; /** * @ORM\OneToMany(targetEntity=Question::class, mappedBy="chapter") */ private $questions; /** * @ORM\ManyToOne(targetEntity=Formation::class, inversedBy="chapters") * @ORM\JoinColumn(nullable=false) */ private $formation; /** * @ORM\Column(type="boolean") */ private $isDelete; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\Column(type="datetime", nullable=true) */ private $updateAt; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $imageName; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $pdfName; /** * @ORM\Column(type="integer") */ private $chapterOrder; /** * @ORM\Column(type="text", nullable=true) */ private $description; public function __construct() { $this->questions = new ArrayCollection(); $this->setIsDelete(0); $this->createdAt = new \DateTime(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getMovieName(): ?string { return $this->movieName; } public function setMovieName(?string $movieName): self { $this->movieName = $movieName; return $this; } public function getAudioName(): ?string { return $this->audioName; } public function setAudioName(?string $audioName): self { $this->audioName = $audioName; return $this; } /** * @return Collection|Question[] */ public function getQuestions(): Collection { return $this->questions; } public function addQuestion(Question $question): self { if (!$this->questions->contains($question)) { $this->questions[] = $question; $question->setChapter($this); } return $this; } public function removeQuestion(Question $question): self { if ($this->questions->removeElement($question)) { // set the owning side to null (unless already changed) if ($question->getChapter() === $this) { $question->setChapter(null); } } return $this; } public function getFormation(): ?Formation { return $this->formation; } public function setFormation(?Formation $formation): self { $this->formation = $formation; return $this; } public function getIsDelete(): ?bool { return $this->isDelete; } public function setIsDelete(bool $isDelete): self { $this->isDelete = $isDelete; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdateAt(): ?\DateTimeInterface { return $this->updateAt; } public function setUpdateAt(?\DateTimeInterface $updateAt): self { $this->updateAt = $updateAt; return $this; } /** * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $imageFile * */ 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; } /** * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $imageFile * */ public function setAudioFile(?File $audioFile = null): void { $this->audioFile = $audioFile; if (null !== $audioFile) { // 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 getAudioFile(): ?File { return $this->audioFile; } /** * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $imageFile * */ public function setimageFile(?File $imageFile = null): void { $this->imageFile = $imageFile; if (null !== $imageFile) { // 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 getImageFile(): ?File { return $this->imageFile; } public function getImageName(): ?string { return $this->imageName; } public function setImageName(?string $imageName): self { $this->imageName = $imageName; return $this; } public function getPdfName(): ?string { return $this->pdfName; } public function setPdfName(?string $pdfName): self { $this->pdfName = $pdfName; return $this; } public function getChapterOrder(): ?int { return $this->chapterOrder; } public function setChapterOrder(int $chapterOrder): self { $this->chapterOrder = $chapterOrder; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): self { $this->description = $description; return $this; } }