src/Entity/Import.php line 68

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  4. use ApiPlatform\Metadata\ApiFilter;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use ApiPlatform\Metadata\Get;
  7. use ApiPlatform\Metadata\GetCollection;
  8. use ApiPlatform\Metadata\Post;
  9. use App\Controller\Action\ImportActionController;
  10. use App\Controller\Action\UploadDataTmpFileAction;
  11. use App\Repository\ImportRepository;
  12. use Doctrine\DBAL\Types\Types;
  13. use Doctrine\ORM\Mapping as ORM;
  14. #[ORM\Entity(repositoryClassImportRepository::class)]
  15. #[ApiResource(
  16.     operations: [
  17.         new Get(),
  18.         new GetCollection(),
  19.         new Post(
  20.             uriTemplate'/imports/import',
  21.             controllerImportActionController::class,
  22.             openapiContext: [
  23.                 'requestBody' => [
  24.                     'content' => [
  25.                         'multipart/form-data' => [
  26.                             'schema' => [
  27.                                 'type' => 'object',
  28.                                 'properties' => [
  29.                                     'model' => [
  30.                                         'type' => 'string',
  31.                                         'format' => 'int'
  32.                                     ],
  33.                                     'params' => [
  34.                                         'type' => 'array',
  35.                                         'format' => 'array'
  36.                                     ],
  37.                                     'file' => [
  38.                                         'type' => 'string',
  39.                                         'format' => 'binary'
  40.                                     ],
  41.                                     'site_id' => [
  42.                                         'type' => 'string',
  43.                                         'format' => 'int'
  44.                                     ]
  45.                                 ]
  46.                             ]
  47.                         ]
  48.                     ]
  49.                 ]
  50.             ],
  51.             deserializefalse,
  52.             validatefalse
  53.         )
  54.     ]
  55. )]
  56. #[ApiFilter(
  57.     SearchFilter::class,
  58.     properties: [
  59.         'status' => 'exact',
  60.         'siteId' => 'exact',
  61.         'documentId' => 'exact',
  62.         'model' => 'exact',
  63.     ]
  64. )]
  65. class Import
  66. {
  67.     #[ORM\Id]
  68.     #[ORM\GeneratedValue]
  69.     #[ORM\Column]
  70.     private ?int $id null;
  71.     #[ORM\Column(length255)]
  72.     private ?string $model null;
  73.     #[ORM\Column(length255)]
  74.     private ?string $status null;
  75.     #[ORM\Column]
  76.     private ?\DateTimeImmutable $created_at null;
  77.     #[ORM\Column(nullabletrue)]
  78.     private ?\DateTimeImmutable $updated_at null;
  79.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  80.     private ?string $message null;
  81.     #[ORM\Column(length255nullabletrue)]
  82.     private ?string $file null;
  83.     #[ORM\Column(length255nullabletrue)]
  84.     private ?int $siteId null;
  85.     #[ORM\Column(nullabletrue)]
  86.     private array $params = [];
  87.     #[ORM\ManyToOne]
  88.     private ?User $user null;
  89.     #[ORM\Column(length255nullabletrue)]
  90.     private ?int $documentId null;
  91.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  92.     private ?array $import_summary null;
  93.     public function getId(): ?int
  94.     {
  95.         return $this->id;
  96.     }
  97.     public function getModel(): ?string
  98.     {
  99.         return $this->model;
  100.     }
  101.     public function setModel(string $model): self
  102.     {
  103.         $this->model $model;
  104.         return $this;
  105.     }
  106.     public function getStatus(): ?string
  107.     {
  108.         return $this->status;
  109.     }
  110.     public function setStatus(string $status): self
  111.     {
  112.         $this->status $status;
  113.         return $this;
  114.     }
  115.     public function getCreatedAt(): ?\DateTimeImmutable
  116.     {
  117.         return $this->created_at;
  118.     }
  119.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  120.     {
  121.         $this->created_at $created_at;
  122.         return $this;
  123.     }
  124.     public function getUpdatedAt(): ?\DateTimeImmutable
  125.     {
  126.         return $this->updated_at;
  127.     }
  128.     public function setUpdatedAt(?\DateTimeImmutable $updated_at): self
  129.     {
  130.         $this->updated_at $updated_at;
  131.         return $this;
  132.     }
  133.     public function getMessage(): ?string
  134.     {
  135.         return $this->message;
  136.     }
  137.     public function setMessage(?string $message): self
  138.     {
  139.         $this->message $message;
  140.         return $this;
  141.     }
  142.     public function getFile(): ?string
  143.     {
  144.         return $this->file;
  145.     }
  146.     public function setFile(?string $file): self
  147.     {
  148.         $this->file $file;
  149.         return $this;
  150.     }
  151.     public function getParams(): array
  152.     {
  153.         return $this->params;
  154.     }
  155.     public function setParams(?array $params): self
  156.     {
  157.         $this->params $params;
  158.         return $this;
  159.     }
  160.     public function getUser(): ?User
  161.     {
  162.         return $this->user;
  163.     }
  164.     public function setUser(?User $user): self
  165.     {
  166.         $this->user $user;
  167.         return $this;
  168.     }
  169.     /**
  170.      * @return int|null
  171.      */
  172.     public function getSiteId(): ?int
  173.     {
  174.         return $this->siteId;
  175.     }
  176.     /**
  177.      * @param int|null $siteId
  178.      */
  179.     public function setSiteId(?int $siteId): void
  180.     {
  181.         $this->siteId $siteId;
  182.     }
  183.     /**
  184.      * @return int|null
  185.      */
  186.     public function getDocumentId(): ?int
  187.     {
  188.         return $this->documentId;
  189.     }
  190.     /**
  191.      * @param int|null $documentId
  192.      */
  193.     public function setDocumentId(?int $documentId): void
  194.     {
  195.         $this->documentId $documentId;
  196.     }
  197.     public function getImportSummary(): ?array
  198.     {
  199.         return $this->import_summary;
  200.     }
  201.     public function setImportSummary(?array $import_summary): self
  202.     {
  203.         $this->import_summary $import_summary;
  204.         return $this;
  205.     }
  206. }