<?php
namespace App\V4\Entity;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Blameable\Traits\BlameableEntity as BlameableTrait;
use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
use Gedmo\Timestampable\Traits\TimestampableEntity as TimestampableTrait;
/**
* @ApiResource(
* shortName="v4/PreconfiguredExport",
* attributes={
* "api_allow_update": true,
* "pagination_enabled": false
* },
* collectionOperations={
* "get": {
* "path": "/v4/preconfigured-export",
* "swagger_context": {
* "responses": {
* "200": {
* "description": "Liste des configurations d'export",
* "schema": {
* "type": "object",
* "properties": {
* "hydra:members": {
* "type": "array",
* "items": {
* "type": "object",
* "properties": {
* "id": { "type": "string" },
* "label": { "type": "string" }
* }
* }
* }
* }
* }
* }
* }
* }
* }
* },
* itemOperations={
* "post_export_download": {
* "method": "POST",
* "path": "/v4/preconfigured-export/{id}/export",
* "controller": App\V4\Action\Export\EntityPreConfiguredExportRequestAction::class,
* "swagger_context": {
* "summary": "Demande de téléchargement d'un export préconfiguré",
* "description": "Demande de téléchargement d'un export préconfiguré ou 'id' est l'id de la configuration choisie",
* "parameters": {
* {
* "in": "path",
* "name": "id",
* "type": "string",
* "required": "true"
* },
* {
* "in": "body",
* "name": "body",
* "required": "true",
* "schema": {
* "type": "object",
* "properties": {
* "ids": {
* "type": "array",
* "items": {"type": "string"}
* },
* },
* },
* },
* },
* "responses": {
* "200": {
* "description": "Demande d'export créée avec succès",
* "schema": {
* "type": "object",
* "properties": {
* "message": {"type": "string", "example": "export_request_created"},
* }
* }
* },
* "400": {
* "description": "Ids manquants",
* "schema": {
* "type": "object",
* "properties": {
* "message": {"type": "string", "example": "missing_ids"},
* }
* }
* },
* "404": {
* "description": "Configuration d'export introuvable",
* "schema": {
* "type": "object",
* "properties": {
* "message": {"type": "string", "example": "configuration_not_found"},
* }
* }
* },
* "422": {
* "description": "Tableau d'ids en paramètre vide",
* "schema": {
* "type": "object",
* "properties": {
* "message": {"type": "string", "example": "empty_ids"},
* }
* }
* },
* },
* }
* }
* },
* )
*
* @ApiFilter(SearchFilter::class, properties={
* "customerId": "exact",
* "entity": "exact",
* "tabId": "exact"
* })
*
* @ORM\Entity(repositoryClass="App\V4\Repository\PreconfiguredExportRepository")
* @ORM\Table(name="preconfigured_export", indexes={
* @ORM\Index(name="IX_PreconfiguredExport_Entity_TabId_CustomerId", columns={"entity", "tab_id", "customer_id"})
* })
*/
class PreconfiguredExport
{
use TimestampableTrait;
use BlameableTrait;
use SoftDeleteableEntity;
/**
* @var string
*
* @ApiProperty(identifier=true)
*
* @ORM\Id()
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class="App\Doctrine\UlidGenerator")
* @ORM\Column(name="id", type="string", length=26)
*/
private $id;
/**
* @var string
*
* @ORM\Column(type="string", length=255)
*/
private $customerId;
/**
* @var string|null
*
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $entity;
/**
* @var string|null
*
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $tabId;
/**
* @var string
*
* @ORM\Column(type="string", length=255)
*/
private $label;
/**
* @var string
*
* @ORM\Column(type="text")
*/
private $content;
/**
* @var bool
*
* @ORM\Column(type="boolean", options={"default": 1})
*/
private $isAsync = true;
public function getId(): string
{
return $this->id;
}
public function setId(string $id): self
{
$this->id = $id;
return $this;
}
public function getCustomerId(): string
{
return $this->customerId;
}
public function setCustomerId(string $customerId): self
{
$this->customerId = $customerId;
return $this;
}
public function getEntity(): ?string
{
return $this->entity;
}
public function setEntity(?string $entity): self
{
$this->entity = $entity;
return $this;
}
public function getTabId(): ?string
{
return $this->tabId;
}
public function setTabId(string $tabId): self
{
$this->tabId = $tabId;
return $this;
}
public function getLabel(): string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
public function getContent(): string
{
return $this->content;
}
public function setContent(string $content): self
{
$this->content = $content;
return $this;
}
public function isAsync(): bool
{
return $this->isAsync;
}
public function setIsAsync(bool $isAsync): self
{
$this->isAsync = $isAsync;
return $this;
}
}