src/V4/Entity/PreconfiguredExport.php line 132

Open in your IDE?
  1. <?php
  2. namespace App\V4\Entity;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiProperty;
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Blameable\Traits\BlameableEntity as BlameableTrait;
  9. use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
  10. use Gedmo\Timestampable\Traits\TimestampableEntity as TimestampableTrait;
  11. /**
  12.  * @ApiResource(
  13.  *     shortName="v4/PreconfiguredExport",
  14.  *     attributes={
  15.  *         "api_allow_update": true,
  16.  *         "pagination_enabled": false
  17.  *     },
  18.  *     collectionOperations={
  19.  *         "get": {
  20.  *             "path": "/v4/preconfigured-export",
  21.  *             "swagger_context": {
  22.  *                 "responses": {
  23.  *                     "200": {
  24.  *                         "description": "Liste des configurations d'export",
  25.  *                         "schema": {
  26.  *                             "type": "object",
  27.  *                             "properties": {
  28.  *                                 "hydra:members": {
  29.  *                                     "type": "array",
  30.  *                                     "items": {
  31.  *                                         "type": "object",
  32.  *                                         "properties": {
  33.  *                                             "id": { "type": "string" },
  34.  *                                             "label": { "type": "string" }
  35.  *                                         }
  36.  *                                     }
  37.  *                                 }
  38.  *                             }
  39.  *                         }
  40.  *                     }
  41.  *                 }
  42.  *             }
  43.  *         }
  44.  *     },
  45.  *     itemOperations={
  46.  *         "post_export_download": {
  47.  *             "method": "POST",
  48.  *             "path": "/v4/preconfigured-export/{id}/export",
  49.  *             "controller": App\V4\Action\Export\EntityPreConfiguredExportRequestAction::class,
  50.  *             "swagger_context": {
  51.  *                 "summary": "Demande de téléchargement d'un export préconfiguré",
  52.  *                 "description": "Demande de téléchargement d'un export préconfiguré ou 'id' est l'id de la configuration choisie",
  53.  *                 "parameters": {
  54.  *                     {
  55.  *                         "in": "path",
  56.  *                         "name": "id",
  57.  *                         "type": "string",
  58.  *                         "required": "true"
  59.  *                     },
  60.  *                     {
  61.  *                         "in": "body",
  62.  *                         "name": "body",
  63.  *                         "required": "true",
  64.  *                         "schema": {
  65.  *                             "type": "object",
  66.  *                             "properties": {
  67.  *                                 "ids": {
  68.  *                                     "type": "array",
  69.  *                                     "items": {"type": "string"}
  70.  *                                 },
  71.  *                             },
  72.  *                         },
  73.  *                     },
  74.  *                 },
  75.  *                 "responses": {
  76.  *                     "200": {
  77.  *                         "description": "Demande d'export créée avec succès",
  78.  *                         "schema": {
  79.  *                              "type": "object",
  80.  *                              "properties": {
  81.  *                                   "message": {"type": "string", "example": "export_request_created"},
  82.  *                              }
  83.  *                         }
  84.  *                     },
  85.  *                     "400": {
  86.  *                         "description": "Ids manquants",
  87.  *                         "schema": {
  88.  *                             "type": "object",
  89.  *                             "properties": {
  90.  *                                 "message": {"type": "string", "example": "missing_ids"},
  91.  *                             }
  92.  *                         }
  93.  *                     },
  94.  *                     "404": {
  95.  *                         "description": "Configuration d'export introuvable",
  96.  *                         "schema": {
  97.  *                             "type": "object",
  98.  *                             "properties": {
  99.  *                                 "message": {"type": "string", "example": "configuration_not_found"},
  100.  *                             }
  101.  *                         }
  102.  *                     },
  103.  *                     "422": {
  104.  *                         "description": "Tableau d'ids en paramètre vide",
  105.  *                         "schema": {
  106.  *                             "type": "object",
  107.  *                             "properties": {
  108.  *                                 "message": {"type": "string", "example": "empty_ids"},
  109.  *                             }
  110.  *                         }
  111.  *                     },
  112.  *                 },
  113.  *             }
  114.  *         }
  115.  *     },
  116.  * )
  117.  *
  118.  * @ApiFilter(SearchFilter::class, properties={
  119.  *      "customerId": "exact",
  120.  *      "entity": "exact",
  121.  *      "tabId": "exact"
  122.  *  })
  123.  *
  124.  * @ORM\Entity(repositoryClass="App\V4\Repository\PreconfiguredExportRepository")
  125.  * @ORM\Table(name="preconfigured_export", indexes={
  126.  *      @ORM\Index(name="IX_PreconfiguredExport_Entity_TabId_CustomerId", columns={"entity", "tab_id", "customer_id"})
  127.  *  })
  128.  */
  129. class PreconfiguredExport
  130. {
  131.     use TimestampableTrait;
  132.     use BlameableTrait;
  133.     use SoftDeleteableEntity;
  134.     /**
  135.      * @var string
  136.      *
  137.      * @ApiProperty(identifier=true)
  138.      *
  139.      * @ORM\Id()
  140.      * @ORM\GeneratedValue(strategy="CUSTOM")
  141.      * @ORM\CustomIdGenerator(class="App\Doctrine\UlidGenerator")
  142.      * @ORM\Column(name="id", type="string", length=26)
  143.      */
  144.     private $id;
  145.     /**
  146.      * @var string
  147.      *
  148.      * @ORM\Column(type="string", length=255)
  149.      */
  150.     private $customerId;
  151.     /**
  152.      * @var string|null
  153.      *
  154.      * @ORM\Column(type="string", length=255, nullable=true)
  155.      */
  156.     private $entity;
  157.     /**
  158.      * @var string|null
  159.      *
  160.      * @ORM\Column(type="string", length=50, nullable=true)
  161.      */
  162.     private $tabId;
  163.     /**
  164.      * @var string
  165.      *
  166.      * @ORM\Column(type="string", length=255)
  167.      */
  168.     private $label;
  169.     /**
  170.      * @var string
  171.      *
  172.      * @ORM\Column(type="text")
  173.      */
  174.     private $content;
  175.     /**
  176.      * @var bool
  177.      *
  178.      * @ORM\Column(type="boolean", options={"default": 1})
  179.      */
  180.     private $isAsync true;
  181.     public function getId(): string
  182.     {
  183.         return $this->id;
  184.     }
  185.     public function setId(string $id): self
  186.     {
  187.         $this->id $id;
  188.         return $this;
  189.     }
  190.     public function getCustomerId(): string
  191.     {
  192.         return $this->customerId;
  193.     }
  194.     public function setCustomerId(string $customerId): self
  195.     {
  196.         $this->customerId $customerId;
  197.         return $this;
  198.     }
  199.     public function getEntity(): ?string
  200.     {
  201.         return $this->entity;
  202.     }
  203.     public function setEntity(?string $entity): self
  204.     {
  205.         $this->entity $entity;
  206.         return $this;
  207.     }
  208.     public function getTabId(): ?string
  209.     {
  210.         return $this->tabId;
  211.     }
  212.     public function setTabId(string $tabId): self
  213.     {
  214.         $this->tabId $tabId;
  215.         return $this;
  216.     }
  217.     public function getLabel(): string
  218.     {
  219.         return $this->label;
  220.     }
  221.     public function setLabel(string $label): self
  222.     {
  223.         $this->label $label;
  224.         return $this;
  225.     }
  226.     public function getContent(): string
  227.     {
  228.         return $this->content;
  229.     }
  230.     public function setContent(string $content): self
  231.     {
  232.         $this->content $content;
  233.         return $this;
  234.     }
  235.     public function isAsync(): bool
  236.     {
  237.         return $this->isAsync;
  238.     }
  239.     public function setIsAsync(bool $isAsync): self
  240.     {
  241.         $this->isAsync $isAsync;
  242.         return $this;
  243.     }
  244. }