src/Entity/Architecture.php line 17

  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\Timestamp;
  4. use App\Repository\ArchitectureRepository;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Symfony\Component\HttpFoundation\File\UploadedFile;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. #[ORM\Entity(repositoryClassArchitectureRepository::class)]
  12. #[ORM\HasLifecycleCallbacks]
  13. #[Vich\Uploadable]
  14. class Architecture
  15. {
  16.     use Timestamp;
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column]
  20.     private ?int $id null;
  21.     #[ORM\Column(length255)]
  22.     private ?string $name null;
  23.     #[ORM\Column(length255nullabletrue)]
  24.     private ?string $videoId null;
  25.     #[ORM\Column(length255)]
  26.     private ?string $type null;
  27.     /**
  28.      * @var File|null
  29.      **/
  30.     #[Assert\Image(maxSize'50M'maxSizeMessage'Image trop volumineuse maximum 10Mb')]
  31.     #[Assert\Image(mimeTypes: ["image/jpeg""image/jpg""image/png"], mimeTypesMessage"Mauvais format d'image (jpeg, jpg et png)")]
  32.     #[Vich\UploadableField(mapping'architectures'fileNameProperty'image')]
  33.     private $imageFile;
  34.     #[ORM\Column(length255nullabletrue)]
  35.     private ?string $image null;
  36.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  37.     private ?string $description null;
  38.     #[ORM\Column]
  39.     private ?bool $online 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): self
  49.     {
  50.         $this->name $name;
  51.         return $this;
  52.     }
  53.     public function getVideoId(): ?string
  54.     {
  55.         return $this->videoId;
  56.     }
  57.     public function setVideoId(?string $videoId): self
  58.     {
  59.         $this->videoId $videoId;
  60.         return $this;
  61.     }
  62.     public function getType(): ?string
  63.     {
  64.         return $this->type;
  65.     }
  66.     public function setType(string $type): self
  67.     {
  68.         $this->type $type;
  69.         return $this;
  70.     }
  71.     public function getImage(): ?string
  72.     {
  73.         return $this->image;
  74.     }
  75.     public function setImage(?string $image): self
  76.     {
  77.         $this->image $image;
  78.         return $this;
  79.     }
  80.     /**
  81.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile
  82.      */
  83.     public function setImageFile(?File $imageFile null): void
  84.     {
  85.         $this->imageFile $imageFile;
  86.         if (null !== $imageFile) {
  87.             // It is required that at least one field changes if you are using doctrine
  88.             // otherwise the event listeners won't be called and the file is lost
  89.             $this->setUpdated(new \DateTimeImmutable());
  90.         }
  91.     }
  92.     public function getImageFile(): ?File
  93.     {
  94.         return $this->imageFile;
  95.     }
  96.     public function getDescription(): ?string
  97.     {
  98.         return $this->description;
  99.     }
  100.     public function setDescription(?string $description): self
  101.     {
  102.         $this->description $description;
  103.         return $this;
  104.     }
  105.     public function isOnline(): ?bool
  106.     {
  107.         return $this->online;
  108.     }
  109.     public function setOnline(bool $online): self
  110.     {
  111.         $this->online $online;
  112.         return $this;
  113.     }
  114.     public function __toString()
  115.     {
  116.         return $this->getName();
  117.     }
  118. }