src/Entity/Ecommerce/MercadoLivrePergunta.php line 69

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 'MercadoLivrePergunta'.
  19.  *
  20.  * @ApiResource(
  21.  *     normalizationContext={"groups"={"mercadoLivrePergunta", "mercadoLivreItem", "cliente", "clienteConfig", "entityId"},"enable_max_depth"=true},
  22.  *     denormalizationContext={"groups"={"mercadoLivrePergunta"},"enable_max_depth"=true},
  23.  *
  24.  *     itemOperations={
  25.  *          "get"={"path"="/ecommerce/mercadoLivrePergunta/{id}", "security"="is_granted('ROLE_ECOMM_ADMIN')"},
  26.  *          "put"={"path"="/ecommerce/mercadoLivrePergunta/{id}", "security"="is_granted('ROLE_ECOMM_ADMIN')"},
  27.  *          "delete"={"path"="/ecommerce/mercadoLivrePergunta/{id}", "security"="is_granted('ROLE_ADMIN')"}
  28.  *     },
  29.  *     collectionOperations={
  30.  *          "get"={"path"="/ecommerce/mercadoLivrePergunta", "security"="is_granted('ROLE_ECOMM_ADMIN')"},
  31.  *          "post"={"path"="/ecommerce/mercadoLivrePergunta", "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.  *     "status": "exact",
  43.  * })
  44.  *
  45.  * @ApiFilter(SearchFilter::class, properties={
  46.  *     "mercadoLivreItem.clienteConfig.cliente": "exact",
  47.  * })
  48.  * 
  49.  * @ApiFilter(DateFilter::class, properties={"dtPergunta"})
  50.  *
  51.  * @ApiFilter(OrderFilter::class, properties={
  52.  *     "id", 
  53.  *     "updated", 
  54.  *     "mercadoLivreItem.clienteConfig.cliente.nome",
  55.  *     "status",
  56.  *     "dtPergunta",
  57.  * }, arguments={"orderParameterName"="order"})
  58.  *
  59.  * @EntityHandler(entityHandlerClass="App\EntityHandler\Ecommerce\MercadoLivrePerguntaEntityHandler")
  60.  *
  61.  * @ORM\Entity(repositoryClass="App\Repository\Ecommerce\MercadoLivrePerguntaRepository")
  62.  * @ORM\Table(name="ecomm_ml_pergunta")
  63.  *
  64.  * @author Carlos Eduardo Pauluk
  65.  */
  66. class MercadoLivrePergunta implements EntityId
  67. {
  68.     use EntityIdTrait;
  69.     /**
  70.      * @ORM\Column(name="uuid", type="string", nullable=false, length=36)
  71.      * @NotUppercase()
  72.      * @Groups("mercadoLivrePergunta")
  73.      * @Assert\Length(min=36, max=36)
  74.      *
  75.      * @var string|null
  76.      */
  77.     public ?string $UUID null;
  78.     /**
  79.      * Id da pergunta no ML.
  80.      * 
  81.      * @ORM\Column(name="mercadolivre_id", type="bigint", nullable=false)
  82.      * @Groups("mercadoLivreItem")
  83.      *
  84.      * @var null|int
  85.      */
  86.     public ?int $mercadolivreId null;
  87.     
  88.     /**
  89.      *
  90.      * @ORM\Column(name="dt_pergunta", type="datetime", nullable=false)
  91.      * @Groups("mercadoLivrePergunta")
  92.      *
  93.      * @var null|\DateTime
  94.      */
  95.     public ?\DateTime $dtPergunta null;
  96.     
  97.     /**
  98.      * @ORM\Column(name="status", type="string", nullable=false)
  99.      * @Groups("mercadoLivrePergunta")
  100.      *
  101.      * @var null|string
  102.      */
  103.     public ?string $status null;
  104.     
  105.     /**
  106.      *
  107.      * @ORM\ManyToOne(targetEntity="MercadoLivreItem")
  108.      * @ORM\JoinColumn(name="ml_item_id")
  109.      * @Groups("mercadoLivrePergunta")
  110.      *
  111.      * @var null|MercadoLivreItem
  112.      */
  113.     public ?MercadoLivreItem $mercadoLivreItem null;
  114.     /**
  115.      *
  116.      * @ORM\Column(name="json_data", type="json")
  117.      * @var null|array
  118.      * @NotUppercase()
  119.      * @Groups("mercadoLivrePergunta")
  120.      */
  121.     public ?array $jsonData null;
  122. }