src/Entity/Update.php line 29

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Doctrine\Orm\Filter\RangeFilter;
  4. use ApiPlatform\Metadata\ApiFilter;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use ApiPlatform\Metadata\Get;
  7. use ApiPlatform\Metadata\GetCollection;
  8. use App\Entity\Traits\CreatedAtTrait;
  9. use App\Entity\Traits\UpdatedAtTrait;
  10. use App\Repository\UpdateRepository;
  11. use DateTime;
  12. use Doctrine\DBAL\Types\Types;
  13. use Doctrine\ORM\Mapping as ORM;
  14. use Symfony\Component\HttpFoundation\File\File;
  15. use Symfony\Component\Validator\Constraints as Assert;
  16. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  17. #[ORM\HasLifecycleCallbacks]
  18. #[Vich\Uploadable]
  19. #[ORM\Entity(repositoryClassUpdateRepository::class)]
  20. #[ORM\Table(name'`update`')]
  21. #[ApiResource(
  22.     operations: [
  23.         new Get(openapifalse),
  24.         new GetCollection()
  25. ], paginationEnabledfalse)]
  26. class Update
  27. {
  28.     use CreatedAtTrait;
  29.     use UpdatedAtTrait;
  30.     #[ORM\Id]
  31.     #[ORM\GeneratedValue]
  32.     #[ORM\Column]
  33.     #[ApiFilter(RangeFilter::class)]
  34.     private ?int $id null;
  35.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  36.     private ?string $description null;
  37.     #[Vich\UploadableField(mapping'archive_file'fileNameProperty'archive')]
  38.     #[Assert\File(mimeTypes: ['application/zip'])]
  39.     private ?File $archiveFile null;
  40.     #[ORM\Column(length255nullabletrue)]
  41.     private ?string $archive null;
  42.     public function getId(): ?int
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getDescription(): ?string
  47.     {
  48.         return $this->description;
  49.     }
  50.     public function setDescription(?string $description): self
  51.     {
  52.         $this->description $description;
  53.         return $this;
  54.     }
  55.     public function getArchive(): ?string
  56.     {
  57.         return $this->archive;
  58.     }
  59.     public function setArchive(?string $archive): self
  60.     {
  61.         $this->archive $archive;
  62.         return $this;
  63.     }
  64.     public function getArchiveFile(): ?File
  65.     {
  66.         return $this->archiveFile;
  67.     }
  68.     public function setArchiveFile(?File $archiveFile): void
  69.     {
  70.         $this->archiveFile $archiveFile;
  71.         if (null !== $archiveFile) {
  72.             $this->updatedAt = new DateTime();
  73.         }
  74.     }
  75. }