src/Entity/Divertissement.php line 16

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DivertissementRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Entity\Traits\Timestamp;
  6. use Doctrine\DBAL\Types\Types;
  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(repositoryClassDivertissementRepository::class)]
  13. class Divertissement
  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.     #[ORM\Column(length255,nullable:true)]
  25.     private ?string $image null;
  26.     /**
  27.      * @var File|null
  28.      **/
  29.     #[Assert\Image(maxSize'50M'maxSizeMessage'Image trop volumineuse maximum 10Mb')]
  30.     #[Assert\Image(mimeTypes: ["image/jpeg""image/jpg""image/png"], mimeTypesMessage"Mauvais format d'image (jpeg, jpg et png)")]
  31.     #[Vich\UploadableField(mapping'divertissements'fileNameProperty'image')]
  32.     private $imageFile;
  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 getDescription(): ?string
  59.     {
  60.         return $this->description;
  61.     }
  62.     public function setDescription(string $description): static
  63.     {
  64.         $this->description $description;
  65.         return $this;
  66.     }
  67.     public function getLocalisation(): ?string
  68.     {
  69.         return $this->localisation;
  70.     }
  71.     public function setLocalisation(string $localisation): static
  72.     {
  73.         $this->localisation $localisation;
  74.         return $this;
  75.     }
  76.     public function getImage(): ?string
  77.     {
  78.         return $this->image;
  79.     }
  80.     public function setImage(?string $image): self
  81.     {
  82.         $this->image $image;
  83.         return $this;
  84.     }
  85.     /**
  86.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile
  87.      */
  88.     public function setImageFile(?File $imageFile null): void
  89.     {
  90.         $this->imageFile $imageFile;
  91.         if (null !== $imageFile) {
  92.             // It is required that at least one field changes if you are using doctrine
  93.             // otherwise the event listeners won't be called and the file is lost
  94.             $this->setUpdated(new \DateTimeImmutable());
  95.         }
  96.     }
  97.     public function getImageFile(): ?File
  98.     {
  99.         return $this->imageFile;
  100.     }
  101.     public function getSlug(): ?string
  102.     {
  103.         return $this->slug;
  104.     }
  105.     public function setSlug(string $slug): static
  106.     {
  107.         $this->slug $slug;
  108.         return $this;
  109.     }
  110.     public function isOnline(): ?bool
  111.     {
  112.         return $this->online;
  113.     }
  114.     public function setOnline(?bool $online): self
  115.     {
  116.         $this->online $online;
  117.         return $this;
  118.     }
  119.     public function getPosition(): ?int
  120.     {
  121.         return $this->position;
  122.     }
  123.     public function setPosition(?int $position): self
  124.     {
  125.         $this->position $position;
  126.         return $this;
  127.     }
  128.     public function __toString()
  129.     {
  130.         return $this->getTitle();
  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. }