src/Entity/Restaurant.php line 16

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RestaurantRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\DBAL\Types\Types;
  6. use App\Entity\Traits\Timestamp;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. #[ORM\HasLifecycleCallbacks]
  11. #[Vich\Uploadable]
  12. #[ORM\Entity(repositoryClassRestaurantRepository::class)]
  13. class Restaurant
  14. {
  15.     use Timestamp;
  16.     #[ORM\Id]
  17.     #[ORM\GeneratedValue]
  18.     #[ORM\Column]
  19.     private ?int $id null;
  20.     #[ORM\Column(length255)]
  21.     private ?string $title null;
  22.     #[ORM\Column(length255)]
  23.     private ?string $localisation null;
  24.     /**
  25.      * @var File|null
  26.      **/
  27.     #[Assert\Image(maxSize'50M'maxSizeMessage'Image trop volumineuse maximum 10Mb')]
  28.     #[Assert\Image(mimeTypes: ["image/jpeg""image/jpg""image/png"], mimeTypesMessage"Mauvais format d'image (jpeg, jpg et png)")]
  29.     #[Vich\UploadableField(mapping'restaurants'fileNameProperty'image')]
  30.     private $imageFile;
  31.     #[ORM\Column(length255nullabletrue)]
  32.     private ?string $image null;
  33.     #[ORM\Column(length255)]
  34.     private ?string $slug null;
  35.     #[ORM\Column(nullabletrue)]
  36.     private ?bool $online null;
  37.     #[ORM\Column(nullabletrue)]
  38.     private ?int $position null;
  39.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  40.     private ?string $description null;
  41.     #[ORM\Column(length255nullabletrue)]
  42.     private ?string $telephone null;
  43.     #[ORM\Column(length255nullabletrue)]
  44.     private ?string $horaire null;
  45.     public function getId(): ?int
  46.     {
  47.         return $this->id;
  48.     }
  49.     public function getTitle(): ?string
  50.     {
  51.         return $this->title;
  52.     }
  53.     public function setTitle(string $title): static
  54.     {
  55.         $this->title $title;
  56.         return $this;
  57.     }
  58.     public function getLocalisation(): ?string
  59.     {
  60.         return $this->localisation;
  61.     }
  62.     public function setLocalisation(string $localisation): static
  63.     {
  64.         $this->localisation $localisation;
  65.         return $this;
  66.     }
  67.     public function getImage(): ?string
  68.     {
  69.         return $this->image;
  70.     }
  71.     public function setImage(?string $image): self
  72.     {
  73.         $this->image $image;
  74.         return $this;
  75.     }
  76.     /**
  77.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile
  78.      */
  79.     public function setImageFile(?File $imageFile null): void
  80.     {
  81.         $this->imageFile $imageFile;
  82.         if (null !== $imageFile) {
  83.             // It is required that at least one field changes if you are using doctrine
  84.             // otherwise the event listeners won't be called and the file is lost
  85.             $this->setUpdated(new \DateTimeImmutable());
  86.         }
  87.     }
  88.     public function getImageFile(): ?File
  89.     {
  90.         return $this->imageFile;
  91.     }
  92.     public function getSlug(): ?string
  93.     {
  94.         return $this->slug;
  95.     }
  96.     public function setSlug(string $slug): static
  97.     {
  98.         $this->slug $slug;
  99.         return $this;
  100.     }
  101.     public function isOnline(): ?bool
  102.     {
  103.         return $this->online;
  104.     }
  105.     public function setOnline(?bool $online): self
  106.     {
  107.         $this->online $online;
  108.         return $this;
  109.     }
  110.     public function getPosition(): ?int
  111.     {
  112.         return $this->position;
  113.     }
  114.     public function setPosition(?int $position): self
  115.     {
  116.         $this->position $position;
  117.         return $this;
  118.     }
  119.     public function __toString()
  120.     {
  121.         return $this->getTitle();
  122.     }
  123.     public function getDescription(): ?string
  124.     {
  125.         return $this->description;
  126.     }
  127.     public function setDescription(string $description): static
  128.     {
  129.         $this->description $description;
  130.         return $this;
  131.     }
  132.     public function getTelephone(): ?string
  133.     {
  134.         return $this->telephone;
  135.     }
  136.     public function setTelephone(string $telephone): static
  137.     {
  138.         $this->telephone $telephone;
  139.         return $this;
  140.     }
  141.     public function getHoraire(): ?string
  142.     {
  143.         return $this->horaire;
  144.     }
  145.     public function setHoraire(string $horaire): static
  146.     {
  147.         $this->horaire $horaire;
  148.         return $this;
  149.     }
  150. }