src/Entity/MediaObject/MediaPdfDocumentation.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\MediaObject;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\HttpFoundation\File\File;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. /**
  8.  * @ORM\Entity(repositoryClass=MediaPdfDocumentation::class)
  9.  * @Vich\Uploadable
  10.  */
  11. class MediaPdfDocumentation extends MediaObject
  12. {
  13.     /**
  14.      * @Assert\NotNull(message="Veuillez renseigner un fichier avant de sauvegarder.")
  15.      * @Vich\UploadableField(mapping="media_object", fileNameProperty="filePath")
  16.      */
  17.     public ?File $file null;
  18.     /**
  19.      * @var string|null
  20.      *
  21.      * @ORM\Column(nullable=true)
  22.      */
  23.     public $filePath;
  24.     /**
  25.      * @var string|null
  26.      */
  27.     private ?string $contentUrl;
  28.     /**
  29.      * @return string|null
  30.      */
  31.     public function getContentUrl(): ?string
  32.     {
  33.         return $this->contentUrl;
  34.     }
  35.     /**
  36.      * @param string|null $contentUrl
  37.      * @return MediaPdfDocumentation
  38.      */
  39.     public function setContentUrl(?string $contentUrl): MediaPdfDocumentation
  40.     {
  41.         $this->contentUrl $contentUrl;
  42.         return $this;
  43.     }
  44.     /**
  45.      * @return File|null
  46.      */
  47.     public function getFile(): ?File
  48.     {
  49.         return $this->file;
  50.     }
  51.     /**
  52.      * @param File|null $file
  53.      * @return MediaPdfDocumentation
  54.      */
  55.     public function setFile(?File $file): MediaPdfDocumentation
  56.     {
  57.         $this->file $file;
  58.         if ($file) {
  59.             $this->updatedAt = new \DateTime();
  60.         }
  61.         return $this;
  62.     }
  63.     /**
  64.      * @return string|null
  65.      */
  66.     public function getFilePath(): ?string
  67.     {
  68.         return $this->filePath;
  69.     }
  70.     /**
  71.      * @param string|null $filePath
  72.      * @return MediaPdfDocumentation
  73.      */
  74.     public function setFilePath(?string $filePath): MediaPdfDocumentation
  75.     {
  76.         $this->filePath $filePath;
  77.         return $this;
  78.     }
  79. }