src/Entity/Setting.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SettingRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\HttpFoundation\File\File;
  7. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  8. #[ORM\Entity(repositoryClassSettingRepository::class)]
  9. #[Vich\Uploadable]
  10. class Setting
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length255)]
  17.     private ?string $name_key null;
  18.     #[ORM\Column(length255nullabletrue)]
  19.     private ?string $value null;
  20.     // NOTE: This is not a mapped field of entity metadata, just a simple property.
  21.     #[Vich\UploadableField(mapping'setting_image'fileNameProperty'image',originalName:'nomInitial')]
  22.     private ?File $imageFile null;
  23.     #[ORM\Column(length255nullabletrue)]
  24.     private ?string $image null;
  25.     #[ORM\Column(length255,nullabletrue)]
  26.     private ?string $nomInitial null;
  27.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  28.     private ?\DateTimeInterface $createdAt null;
  29.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  30.     private ?\DateTimeInterface $updatedAt null;
  31.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  32.     private ?string $description null;
  33.     #[ORM\Column(length255nullabletrue)]
  34.     private ?string $website_name null;
  35.     public function __construct()
  36.     {
  37.         $this->createdAt = new \DateTimeImmutable('now');
  38.         $this->updatedAt = new \DateTimeImmutable('now');
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getNameKey(): ?string
  45.     {
  46.         return $this->name_key;
  47.     }
  48.     public function setNameKey(string $name_key): self
  49.     {
  50.         $this->name_key $name_key;
  51.         return $this;
  52.     }
  53.     public function getValue(): ?string
  54.     {
  55.         return $this->value;
  56.     }
  57.     public function setValue(?string $value): self
  58.     {
  59.         $this->value $value;
  60.         return $this;
  61.     }
  62.     public function getDescription(): ?string
  63.     {
  64.         return $this->description;
  65.     }
  66.     public function setDescription(?string $description): self
  67.     {
  68.         $this->description $description;
  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.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  82.      * of 'UploadedFile' is injected into this setter to trigger the update. If this
  83.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  84.      * must be able to accept an instance of 'File' as the bundle will inject one here
  85.      * during Doctrine hydration.
  86.      *
  87.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile
  88.      */
  89.     public function setImageFile(?File $imageFile null): void
  90.     {
  91.         $this->imageFile $imageFile;
  92.         if (null !== $imageFile) {
  93.             // It is required that at least one field changes if you are using doctrine
  94.             // otherwise the event listeners won't be called and the file is lost
  95.             $this->updatedAt = new \DateTimeImmutable();
  96.         }
  97.     }
  98.     public function getImageFile(): ?File
  99.     {
  100.         return $this->imageFile;
  101.     }
  102.     public function getNomInitial(): ?string
  103.     {
  104.         return $this->nomInitial;
  105.     }
  106.     public function setNomInitial(string $nomInitialnull): self
  107.     {
  108.         $this->nomInitial $nomInitial;
  109.         return $this;
  110.     }
  111.     public function getCreatedAt(): ?\DateTimeInterface
  112.     {
  113.         return $this->createdAt;
  114.     }
  115.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  116.     {
  117.         $this->createdAt $createdAt;
  118.         return $this;
  119.     }
  120.     public function getUpdatedAt(): ?\DateTimeInterface
  121.     {
  122.         return $this->updatedAt;
  123.     }
  124.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  125.     {
  126.         $this->updatedAt $updatedAt;
  127.         return $this;
  128.     }
  129.     public function getWebsiteName(): ?string
  130.     {
  131.         return $this->website_name;
  132.     }
  133.     public function setWebsiteName(?string $website_name): self
  134.     {
  135.         $this->website_name $website_name;
  136.         return $this;
  137.     }
  138. }