src/Entity/Prestation.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PrestationRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. #[ORM\Entity(repositoryClassPrestationRepository::class)]
  8. #[Vich\Uploadable]
  9. class Prestation
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $title null;
  17.     #[ORM\ManyToOne(inversedBy'prestations')]
  18.     #[ORM\JoinColumn(nullablefalse)]
  19.     private ?Categories $categorie null;
  20.     #[Vich\UploadableField(mapping'presta_images'fileNameProperty'imageName')]
  21.     private ?File $imageFile null;
  22.     #[ORM\Column(nullabletrue)]
  23.     private ?string $imageName null;
  24.     public function getId(): ?int
  25.     {
  26.         return $this->id;
  27.     }
  28.     public function getTitle(): ?string
  29.     {
  30.         return $this->title;
  31.     }
  32.     public function setTitle(string $title): static
  33.     {
  34.         $this->title $title;
  35.         return $this;
  36.     }
  37.     public function getCategorie(): ?Categories
  38.     {
  39.         return $this->categorie;
  40.     }
  41.     public function setCategorie(?Categories $categorie): static
  42.     {
  43.         $this->categorie $categorie;
  44.         return $this;
  45.     }
  46.     public function setImageFile(?File $imageFile null): void
  47.     {
  48.         $this->imageFile $imageFile;
  49.         if (null !== $imageFile) {
  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.             $this->updatedAt = new \DateTimeImmutable();
  53.         }
  54.     }
  55.     public function getImageFile(): ?File
  56.     {
  57.         return $this->imageFile;
  58.     }
  59.     public function setImageName(?string $imageName): void
  60.     {
  61.         $this->imageName $imageName;
  62.     }
  63.     public function getImageName(): ?string
  64.     {
  65.         return $this->imageName;
  66.     }
  67. }