src/Entity/Ecommerce/TrayVenda.php line 74

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Ecommerce;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
  6. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  7. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  8. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter;
  9. use ApiPlatform\Core\Serializer\Filter\PropertyFilter;
  10. use CrosierSource\CrosierLibBaseBundle\Doctrine\Annotations\EntityHandler;
  11. use CrosierSource\CrosierLibBaseBundle\Doctrine\Annotations\NotUppercase;
  12. use CrosierSource\CrosierLibBaseBundle\Entity\EntityId;
  13. use CrosierSource\CrosierLibBaseBundle\Entity\EntityIdTrait;
  14. use Doctrine\ORM\Mapping as ORM;
  15. use Symfony\Component\Serializer\Annotation\Groups;
  16. use Symfony\Component\Validator\Constraints as Assert;
  17. /**
  18.  * Entidade 'TrayVenda'.
  19.  *
  20.  * @ApiResource(
  21.  *     normalizationContext={"groups"={"trayVenda", "clienteConfig", "cliente", "entityId"},"enable_max_depth"=true},
  22.  *     denormalizationContext={"groups"={"trayVenda"},"enable_max_depth"=true},
  23.  *
  24.  *     itemOperations={
  25.  *          "get"={"path"="/ecommerce/trayVenda/{id}", "security"="is_granted('ROLE_ECOMM_ADMIN')"},
  26.  *          "put"={"path"="/ecommerce/trayVenda/{id}", "security"="is_granted('ROLE_ECOMM_ADMIN')"},
  27.  *          "delete"={"path"="/ecommerce/trayVenda/{id}", "security"="is_granted('ROLE_ADMIN')"}
  28.  *     },
  29.  *     collectionOperations={
  30.  *          "get"={"path"="/ecommerce/trayVenda", "security"="is_granted('ROLE_ECOMM_ADMIN')"},
  31.  *          "post"={"path"="/ecommerce/trayVenda", "security"="is_granted('ROLE_ECOMM_ADMIN')"}
  32.  *     },
  33.  *
  34.  *     attributes={
  35.  *          "pagination_items_per_page"=10,
  36.  *          "formats"={"jsonld", "csv"={"text/csv"}}
  37.  *     }
  38.  *
  39.  * )
  40.  * @ApiFilter(PropertyFilter::class)
  41.  * @ApiFilter(BooleanFilter::class, properties={
  42.  *     "atual": "exact",
  43.  * })
  44.  *
  45.  * @ApiFilter(SearchFilter::class, properties={
  46.  *     "clienteConfig.cliente": "exact",
  47.  *     "statusTray": "partial",
  48.  *     "idTray": "exact",
  49.  * })
  50.  * 
  51.  * @ApiFilter(DateFilter::class, properties={"dtVenda"})
  52.  *
  53.  * @ApiFilter(OrderFilter::class, properties={
  54.  *     "id", 
  55.  *     "updated", 
  56.  *     "clienteConfig.cliente.nome",
  57.  *     "statusTray",
  58.  *     "dtVenda",
  59.  *     "idTray",
  60.  *     "pointSale",
  61.  *     "valorTotal"
  62.  * }, arguments={"orderParameterName"="order"})
  63.  *
  64.  * @EntityHandler(entityHandlerClass="App\EntityHandler\Ecommerce\TrayVendaEntityHandler")
  65.  *
  66.  * @ORM\Entity(repositoryClass="App\Repository\Ecommerce\TrayVendaRepository")
  67.  * @ORM\Table(name="ecomm_tray_venda")
  68.  *
  69.  * @author Carlos Eduardo Pauluk
  70.  */
  71. class TrayVenda implements EntityId
  72. {
  73.     use EntityIdTrait;
  74.     /**
  75.      * @ORM\Column(name="uuid", type="string", nullable=false, length=36)
  76.      * @NotUppercase()
  77.      * @Groups("trayVenda")
  78.      * @Assert\Length(min=36, max=36)
  79.      *
  80.      * @var string|null
  81.      */
  82.     public ?string $UUID null;
  83.     
  84.     /**
  85.      * @ORM\Column(name="id_tray", type="string", nullable=false)
  86.      * @Groups("trayVenda")
  87.      *
  88.      * @var null|string
  89.      */
  90.     public ?string $idTray null;
  91.     
  92.     /**
  93.      *
  94.      * @ORM\Column(name="dt_venda", type="datetime", nullable=false)
  95.      * @Groups("trayVenda")
  96.      *
  97.      * @var null|\DateTime
  98.      */
  99.     public ?\DateTime $dtVenda null;
  100.     
  101.     /**
  102.      * @ORM\Column(name="status", type="string", nullable=false)
  103.      * @Groups("trayVenda")
  104.      *
  105.      * @var null|string
  106.      */
  107.     public ?string $statusTray null;
  108.     
  109.     /**
  110.      * @ORM\Column(name="point_sale", type="string", nullable=false)
  111.      * @Groups("trayVenda")
  112.      *
  113.      * @var null|string
  114.      */
  115.     public ?string $pointSale null;
  116.     /**
  117.      * @ORM\Column(name="cliente_nome", type="string", nullable=false)
  118.      * @Groups("trayVenda")
  119.      *
  120.      * @var null|string
  121.      */
  122.     public ?string $clienteNome null;
  123.     
  124.     /**
  125.      *
  126.      * @ORM\Column(name="valor_total", type="decimal")
  127.      * @Groups("trayVenda")
  128.      *
  129.      * @var null|float
  130.      */
  131.     public ?float $valorTotal null;
  132.     /**
  133.      *
  134.      * @ORM\ManyToOne(targetEntity="ClienteConfig")
  135.      * @ORM\JoinColumn(name="cliente_config_id")
  136.      * @Groups("trayVenda")
  137.      *
  138.      * @var null|ClienteConfig
  139.      */
  140.     public ?ClienteConfig $clienteConfig null;
  141.     /**
  142.      *
  143.      * @ORM\Column(name="json_data", type="json")
  144.      * @var null|array
  145.      * @NotUppercase()
  146.      * @Groups("trayVenda")
  147.      */
  148.     public ?array $jsonData null;
  149. }