src/Entity/Evenement.php line 16

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