src/Entity/Export.php line 49

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use ApiPlatform\Metadata\Delete;
  5. use ApiPlatform\Metadata\Get;
  6. use ApiPlatform\Metadata\GetCollection;
  7. use ApiPlatform\Metadata\Post;
  8. use ApiPlatform\Metadata\Put;
  9. use App\Controller\Action\CategoryTreeAction;
  10. use App\Controller\Action\ExportByIdentifierAction;
  11. use App\Repository\ExportRepository;
  12. use App\State\CompliancePostProcessor;
  13. use App\State\ExportPostProcessor;
  14. use Doctrine\DBAL\Types\Types;
  15. use Doctrine\ORM\Mapping as ORM;
  16. use Symfony\Component\Serializer\Annotation\Groups;
  17. use App\Controller\Action\DownloadExportByIdentifier;
  18. #[ORM\Entity(repositoryClassExportRepository::class)]
  19. #[ApiResource(
  20.     normalizationContext: ['groups' => ['export.get']],
  21.     denormalizationContext: ['groups' => ['export.write']],
  22.     operations: [
  23.         new GetCollection(),
  24.         new Post(
  25.             processorExportPostProcessor::class
  26.         ),
  27.         new Get(),
  28.         new Get(
  29.             uriTemplate'/exports/by-identifier/{identifier}',
  30.             requirements: ['identifier' => '.+'],
  31.             controllerExportByIdentifierAction::class,
  32.             readfalse,
  33.             deserializefalse
  34.         ),
  35.         new Put(),
  36.         new Get(
  37.             uriTemplate'/exports/{identifier}/download',
  38.             controllerDownloadExportByIdentifier::class,
  39.             requirements: ['identifier' => '.+'],
  40.             readfalse,
  41.             deserializefalse
  42.         ),
  43.         new Delete(),
  44.     ]
  45. )]
  46. class Export
  47. {
  48.     #[ORM\Id]
  49.     #[ORM\GeneratedValue]
  50.     #[ORM\Column]
  51.     private ?int $id null;
  52.     #[ORM\Column(length255)]
  53.     #[Groups(['export.get''export.write'])]
  54.     private ?string $model null;
  55.     #[ORM\Column(length255)]
  56.     #[Groups(['export.get''export.write'])]
  57.     private ?string $status null;
  58.     #[ORM\Column]
  59.     #[Groups(['export.get''export.write'])]
  60.     private ?\DateTimeImmutable $createdAt null;
  61.     #[ORM\Column]
  62.     #[Groups(['export.get''export.write'])]
  63.     private ?\DateTimeImmutable $updatedAt null;
  64.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  65.     #[Groups(['export.get''export.write'])]
  66.     private ?string $message null;
  67.     #[ORM\ManyToOne(inversedBy'exports')]
  68.     #[ORM\JoinColumn(nullablefalse)]
  69.     #[Groups(['export.get''export.write'])]
  70.     private ?User $user null;
  71.     #[ORM\Column(length255nullabletrue)]
  72.     #[Groups(['export.get''export.write'])]
  73.     private ?string $file null;
  74.     #[ORM\Column(nullabletrue)]
  75.     #[Groups(['export.get''export.write'])]
  76.     private array $params = [];
  77.     #[ORM\Column(nullabletrue)]
  78.     #[Groups(['export.get'])]
  79.     private ?string $identifier null;
  80.     #[ORM\Column(length255nullabletrue)]
  81.     #[Groups(['export.get''export.write'])]
  82.     private ?int $siteId null;
  83.     public function getId(): ?int
  84.     {
  85.         return $this->id;
  86.     }
  87.     public function getModel(): ?string
  88.     {
  89.         return $this->model;
  90.     }
  91.     public function setModel(string $model): self
  92.     {
  93.         $this->model $model;
  94.         return $this;
  95.     }
  96.     public function getStatus(): ?string
  97.     {
  98.         return $this->status;
  99.     }
  100.     public function setStatus(string $status): self
  101.     {
  102.         $this->status $status;
  103.         return $this;
  104.     }
  105.     public function getCreatedAt(): ?\DateTimeImmutable
  106.     {
  107.         return $this->createdAt;
  108.     }
  109.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  110.     {
  111.         $this->createdAt $createdAt;
  112.         return $this;
  113.     }
  114.     public function getUpdatedAt(): ?\DateTimeImmutable
  115.     {
  116.         return $this->updatedAt;
  117.     }
  118.     public function setUpdatedAt(\DateTimeImmutable $updatedAt): self
  119.     {
  120.         $this->updatedAt $updatedAt;
  121.         return $this;
  122.     }
  123.     public function getMessage(): ?string
  124.     {
  125.         return $this->message;
  126.     }
  127.     public function setMessage(?string $message): self
  128.     {
  129.         $this->message $message;
  130.         return $this;
  131.     }
  132.     public function getUser(): ?User
  133.     {
  134.         return $this->user;
  135.     }
  136.     public function setUser(?User $user): self
  137.     {
  138.         $this->user $user;
  139.         return $this;
  140.     }
  141.     public function getFile(): ?string
  142.     {
  143.         return $this->file;
  144.     }
  145.     public function setFile(?string $file): self
  146.     {
  147.         $this->file $file;
  148.         return $this;
  149.     }
  150.     public function getParams(): array
  151.     {
  152.         return $this->params;
  153.     }
  154.     public function setParams(?array $params): self
  155.     {
  156.         $this->params $params;
  157.         return $this;
  158.     }
  159.     /**
  160.      * @return string|null
  161.      */
  162.     public function getIdentifier(): ?string
  163.     {
  164.         return $this->identifier;
  165.     }
  166.     /**
  167.      * @param string|null $identifier
  168.      */
  169.     public function setIdentifier(?string $identifier): void
  170.     {
  171.         $this->identifier $identifier;
  172.     }
  173.     /**
  174.      * @return int|null
  175.      */
  176.     public function getSiteId(): ?int
  177.     {
  178.         return $this->siteId;
  179.     }
  180.     /**
  181.      * @param int|null $siteId
  182.      */
  183.     public function setSiteId(?int $siteId): void
  184.     {
  185.         $this->siteId $siteId;
  186.     }
  187. }