src/Entity/Attachment.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AttachmentRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  6. use Vich\UploaderBundle\Form\Type\VichFileType;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. /**
  9.  * @ORM\Entity(repositoryClass=AttachmentRepository::class)
  10.  */
  11. /**
  12.  * @ORM\Entity
  13.  * @Vich\Uploadable
  14.  */
  15. class Attachment
  16. {
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue
  20.      * @ORM\Column(type="integer")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      */
  26.     private $image;
  27.      /**
  28.      * @Vich\UploadableField(mapping="gallerie", fileNameProperty="image")
  29.      * @var File
  30.      */
  31.     private $imageFile2;
  32.     /**
  33.     * @ORM\ManyToOne(targetEntity="EvenementAVenir",inversedBy="attachments")
  34.     */
  35.     private $evenement;
  36.     /**
  37.      * @ORM\Column(type="integer")
  38.      */
  39.     private $evenement_id;
  40.     public function getEvenementId(): ?int
  41.     {
  42.         return $this->evenement_id;
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getImage(): ?string
  49.     {
  50.         return $this->image;
  51.     }
  52.     public function setImage(string $image): self
  53.     {
  54.         $this->image $image;
  55.         return $this;
  56.     }
  57.     public function getEvenement(): ?EvenementAVenir
  58.     {
  59.         return $this->evenement;
  60.     }
  61.     public function setEvenement(?EvenementAVenir $evenement): self
  62.     {
  63.         $this->evenement $evenement;
  64.         return $this;
  65.     }
  66.           public function setImageFile2(File $im null)
  67.     {
  68.         $this->imageFile2 $im;
  69.         // VERY IMPORTANT:
  70.         // It is required that at least one field changes if you are using Doctrine,
  71.         // otherwise the event listeners won't be called and the file is lost
  72.         if ($im) {
  73.             // if 'updatedAt' is not defined in your entity, use another property
  74.             $this->updatedAt = new \DateTime('now');
  75.         }
  76.     }
  77.     public function getImageFile2()
  78.     {
  79.         return $this->imageFile2;
  80.     }
  81.     public function setEvenementId(int $evenement_id): self
  82.     {
  83.         $this->evenement_id $evenement_id;
  84.         return $this;
  85.     }
  86. }