src/Entity/Partner.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PartnerRepository;
  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(repositoryClassPartnerRepository::class)]
  8. #[Vich\Uploadable]
  9. class Partner
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $name null;
  17.     #[Vich\UploadableField(mapping'partner_images'fileNameProperty'imageName')]
  18.     private ?File $imageFile null;
  19.     #[ORM\Column(nullabletrue)]
  20.     private ?string $imageName null;
  21.     public function getId(): ?int
  22.     {
  23.         return $this->id;
  24.     }
  25.     public function getName(): ?string
  26.     {
  27.         return $this->name;
  28.     }
  29.     public function setImageFile(?File $imageFile null): void
  30.     {
  31.         $this->imageFile $imageFile;
  32.         if (null !== $imageFile) {
  33.             // It is required that at least one field changes if you are using doctrine
  34.             // otherwise the event listeners won't be called and the file is lost
  35.             $this->updatedAt = new \DateTimeImmutable();
  36.         }
  37.     }
  38.     public function getImageFile(): ?File
  39.     {
  40.         return $this->imageFile;
  41.     }
  42.     public function setImageName(?string $imageName): void
  43.     {
  44.         $this->imageName $imageName;
  45.     }
  46.     public function getImageName(): ?string
  47.     {
  48.         return $this->imageName;
  49.     }
  50.     public function setName(string $name): static
  51.     {
  52.         $this->name $name;
  53.         return $this;
  54.     }
  55. }