src/Entity/Partner.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PartnerRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Entity\Traits\Timestampable;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. #[ORM\HasLifecycleCallbacks]
  10. #[Vich\Uploadable]
  11. #[ORM\Entity(repositoryClassPartnerRepository::class)]
  12. class Partner
  13. {
  14.     use Timestampable;
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     private ?int $id null;
  19.     #[ORM\Column(length255)]
  20.     private ?string $name null;
  21.     #[ORM\Column(typeTypes::TEXT)]
  22.     private ?string $description null;
  23.     #[ORM\Column(length255)]
  24.     private ?string $logo null;
  25.     
  26.     /**
  27.     * NOTE: This is not a mapped field of entity metadata, just a simple property.
  28.     *
  29.    */
  30.    #[Vich\UploadableField(mapping'partner_logo'fileNameProperty'logo')]
  31.    private ?File $imageFile null;
  32.     #[ORM\Column(length255nullabletrue)]
  33.     private ?string $phone null;
  34.     #[ORM\Column(length255nullabletrue)]
  35.     private ?string $email null;
  36.     #[ORM\Column(length255)]
  37.     private ?string $location null;
  38.     #[ORM\Column(length255)]
  39.     private ?string $slug null;
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getName(): ?string
  45.     {
  46.         return $this->name;
  47.     }
  48.     public function setName(string $name): static
  49.     {
  50.         $this->name $name;
  51.         return $this;
  52.     }
  53.     public function getDescription(): ?string
  54.     {
  55.         return $this->description;
  56.     }
  57.     public function setDescription(string $description): static
  58.     {
  59.         $this->description $description;
  60.         return $this;
  61.     }
  62.     
  63.     /**
  64.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  65.      * of 'UploadedFile' is injected into this setter to trigger the update. If this
  66.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  67.      * must be able to accept an instance of 'File' as the bundle will inject one here
  68.      * during Doctrine hydration.
  69.      *
  70.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile
  71.      */
  72.     public function setImageFile(?File $imageFile null): void
  73.     {
  74.         $this->imageFile $imageFile;
  75.         if (null !== $imageFile) {
  76.             // It is required that at least one field changes if you are using doctrine
  77.             // otherwise the event listeners won't be called and the file is lost
  78.             $this->setUpdatedAt(new \DateTime());
  79.         }
  80.     }
  81.     public function getImageFile(): ?File
  82.     {
  83.         return $this->imageFile;
  84.     }
  85.     public function getLogo(): ?string
  86.     {
  87.         return $this->logo;
  88.     }
  89.     public function setLogo(string $logo): static
  90.     {
  91.         $this->logo $logo;
  92.         return $this;
  93.     }
  94.     public function getPhone(): ?string
  95.     {
  96.         return $this->phone;
  97.     }
  98.     public function setPhone(?string $phone): static
  99.     {
  100.         $this->phone $phone;
  101.         return $this;
  102.     }
  103.     public function getEmail(): ?string
  104.     {
  105.         return $this->email;
  106.     }
  107.     public function setEmail(?string $email): static
  108.     {
  109.         $this->email $email;
  110.         return $this;
  111.     }
  112.     public function getLocation(): ?string
  113.     {
  114.         return $this->location;
  115.     }
  116.     public function setLocation(string $location): static
  117.     {
  118.         $this->location $location;
  119.         return $this;
  120.     }
  121.     public function getSlug(): ?string
  122.     {
  123.         return $this->slug;
  124.     }
  125.     public function setSlug(string $slug): static
  126.     {
  127.         $this->slug $slug;
  128.         return $this;
  129.     }
  130. }