src/Entity/IdentiteVisuelleFile.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\IdentiteVisuelleFileRepository;
  4. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\HttpFoundation\File\File;
  7. /**
  8.  * @Vich\Uploadable
  9.  */
  10. #[ORM\Entity(repositoryClassIdentiteVisuelleFileRepository::class)]
  11. class IdentiteVisuelleFile
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column(type'integer')]
  16.     private ?int $id null;
  17.     #[ORM\Column(type'string'length255)]
  18.     private ?string $categorie null;
  19.     #[ORM\Column(type'string'length255)]
  20.     private ?string $fileName null;
  21.     /**
  22.      * @Vich\UploadableField(mapping="identite_visuelle_file", fileNameProperty="fileName")
  23.      * @var File
  24.      */
  25.     private $file;
  26.     #[ORM\ManyToOne(targetEntityIdentiteVisuelle::class, inversedBy'file')]
  27.     #[ORM\JoinColumn(nullablefalse)]
  28.     private $identiteVisuelle;
  29.     #[ORM\Column(type'string'length255)]
  30.     private $libelle;
  31.     #[ORM\Column(type'datetime')]
  32.     private $updatedAt;
  33.     #[ORM\ManyToOne(targetEntityIdentiteVisuelleCategory::class, inversedBy'identiteVisuelleFiles')]
  34.     #[ORM\JoinColumn(onDelete'SET NULL')]
  35.     private $identiteVisuelleCategory;
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getCategorie(): ?string
  41.     {
  42.         return $this->categorie;
  43.     }
  44.     public function setCategorie(string $categorie): self
  45.     {
  46.         $this->categorie $categorie;
  47.         return $this;
  48.     }
  49.     public function getFileName(): ?string
  50.     {
  51.         return $this->fileName;
  52.     }
  53.     public function setFileName(?string $fileName): self
  54.     {
  55.         $this->fileName $fileName;
  56.         return $this;
  57.     }
  58.     public function setFile(?File $file null)
  59.     {
  60.         $this->file $file;
  61.         // VERY IMPORTANT:
  62.         // It is required that at least one field changes if you are using Doctrine,
  63.         // otherwise the event listeners won't be called and the file is lost
  64.         if ($file) {
  65.             // if 'updatedAt' is not defined in your entity, use another property
  66.             $this->updatedAt = new \DateTime('now');
  67.         }
  68.     }
  69.     public function getFile()
  70.     {
  71.         return $this->file;
  72.     }
  73.     public function getIdentiteVisuelle(): ?IdentiteVisuelle
  74.     {
  75.         return $this->identiteVisuelle;
  76.     }
  77.     public function setIdentiteVisuelle(?IdentiteVisuelle $identiteVisuelle): self
  78.     {
  79.         $this->identiteVisuelle $identiteVisuelle;
  80.         return $this;
  81.     }
  82.     public function getLibelle(): ?string
  83.     {
  84.         return $this->libelle;
  85.     }
  86.     public function setLibelle(string $libelle): self
  87.     {
  88.         $this->libelle $libelle;
  89.         return $this;
  90.     }
  91.     public function getUpdatedAt(): ?\DateTimeInterface
  92.     {
  93.         return $this->updatedAt;
  94.     }
  95.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  96.     {
  97.         $this->updatedAt $updatedAt;
  98.         return $this;
  99.     }
  100.     public function getIdentiteVisuelleCategory(): ?IdentiteVisuelleCategory
  101.     {
  102.         return $this->identiteVisuelleCategory;
  103.     }
  104.     public function setIdentiteVisuelleCategory(?IdentiteVisuelleCategory $identiteVisuelleCategory): self
  105.     {
  106.         $this->identiteVisuelleCategory $identiteVisuelleCategory;
  107.         return $this;
  108.     }
  109. }