src/Entity/Activity.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ActivityRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. #[ORM\Entity(repositoryClassActivityRepository::class)]
  8. #[Vich\Uploadable]
  9. class Activity
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $title null;
  17.     #[Vich\UploadableField(mapping'activity'fileNameProperty'imageName')]
  18.     private ?File $imageFile null;
  19.     #[ORM\Column(nullabletrue)]
  20.     private ?string $imageName null;
  21.     #[ORM\Column]
  22.     private ?bool $active null;
  23.     #[ORM\Column(length255)]
  24.     private ?string $description null;
  25.     public function getId(): ?int
  26.     {
  27.         return $this->id;
  28.     }
  29.     public function getTitle(): ?string
  30.     {
  31.         return $this->title;
  32.     }
  33.     public function setTitle(string $title): self
  34.     {
  35.         $this->title $title;
  36.         return $this;
  37.     }
  38.     public function setImageFile(?File $imageFile null): void
  39.     {
  40.         $this->imageFile $imageFile;
  41.         if (null !== $imageFile) {
  42.             // It is required that at least one field changes if you are using doctrine
  43.             // otherwise the event listeners won't be called and the file is lost
  44.             $this->updatedAt = new \DateTimeImmutable();
  45.         }
  46.     }
  47.     public function getImageFile(): ?File
  48.     {
  49.         return $this->imageFile;
  50.     }
  51.     public function setImageName(?string $imageName): void
  52.     {
  53.         $this->imageName $imageName;
  54.     }
  55.     public function getImageName(): ?string
  56.     {
  57.         return $this->imageName;
  58.     }
  59.     public function isActive(): ?bool
  60.     {
  61.         return $this->active;
  62.     }
  63.     public function setActive(bool $active): self
  64.     {
  65.         $this->active $active;
  66.         return $this;
  67.     }
  68.     public function getDescription(): ?string
  69.     {
  70.         return $this->description;
  71.     }
  72.     public function setDescription(string $description): self
  73.     {
  74.         $this->description $description;
  75.         return $this;
  76.     }
  77. }