src/Entity/CBRCArticleContentFile.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CBRCArticleContentFileRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. /**
  8.  * @ORM\Entity(repositoryClass=CBRCArticleContentFileRepository::class)
  9.  * * @Vich\Uploadable
  10.  */
  11. class CBRCArticleContentFile
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $image1;
  23.     /**
  24.      * @Vich\UploadableField(mapping="article_images_content", fileNameProperty="image1")
  25.      * @var File
  26.      */
  27.     private $image1File;
  28.     /**
  29.      * @ORM\Column(type="datetime", nullable=true)
  30.      * @var \DateTime
  31.      */
  32.     private $updatedAt;
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getImage1(): ?string
  38.     {
  39.         return $this->image1;
  40.     }
  41.     public function setImage1(string $image1): self
  42.     {
  43.         $this->image1 $image1;
  44.         return $this;
  45.     }
  46.     public function setImage1File(File $image null)
  47.     {
  48.         $this->image1File $image;
  49.         // VERY IMPORTANT:
  50.         // It is required that at least one field changes if you are using Doctrine,
  51.         // otherwise the event listeners won't be called and the file is lost
  52.         if ($image) {
  53.             // if 'updatedAt' is not defined in your entity, use another property
  54.             $this->updatedAt = new \DateTime('now');
  55.         }
  56.     }
  57.     public function getImage1File()
  58.     {
  59.         return $this->image1File;
  60.     }
  61. }