vendor/crosiersource/crosierlib-radx/src/Entity/Fiscal/NotaFiscalVenda.php line 46

Open in your IDE?
  1. <?php
  2. namespace CrosierSource\CrosierLibRadxBundle\Entity\Fiscal;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  6. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  7. use ApiPlatform\Core\Serializer\Filter\PropertyFilter;
  8. use CrosierSource\CrosierLibBaseBundle\Doctrine\Annotations\EntityHandler;
  9. use CrosierSource\CrosierLibBaseBundle\Entity\EntityId;
  10. use CrosierSource\CrosierLibBaseBundle\Entity\EntityIdTrait;
  11. use CrosierSource\CrosierLibRadxBundle\Entity\Vendas\Venda;
  12. use Doctrine\ORM\Mapping as ORM;
  13. /**
  14.  * @ApiResource(
  15.  *     normalizationContext={"groups"={"notaFiscalVenda","entityId"},"enable_max_depth"=true},
  16.  *     denormalizationContext={"groups"={"notaFiscalVenda"},"enable_max_depth"=true},
  17.  *
  18.  *     itemOperations={
  19.  *          "get"={"path"="/fis/notaFiscalVenda/{id}", "security"="is_granted('ROLE_FISCAL')"},
  20.  *          "put"={"path"="/fis/notaFiscalVenda/{id}", "security"="is_granted('ROLE_FISCAL')"},
  21.  *          "delete"={"path"="/fis/notaFiscalVenda/{id}", "security"="is_granted('ROLE_ADMIN')"}
  22.  *     },
  23.  *     collectionOperations={
  24.  *          "get"={"path"="/fis/notaFiscalVenda", "security"="is_granted('ROLE_FISCAL')"},
  25.  *          "post"={"path"="/fis/notaFiscalVenda", "security"="is_granted('ROLE_FISCAL')"}
  26.  *     },
  27.  *
  28.  *     attributes={
  29.  *          "pagination_items_per_page"=10,
  30.  *          "formats"={"jsonld", "csv"={"text/csv"}}
  31.  *     }
  32.  * )
  33.  * @ApiFilter(PropertyFilter::class)
  34.  *
  35.  * @ApiFilter(SearchFilter::class, properties={"nome": "partial", "documento": "exact", "id": "exact"})
  36.  * @ApiFilter(OrderFilter::class, properties={"id", "documento", "nome", "updated"}, arguments={"orderParameterName"="order"})
  37.  *
  38.  * @EntityHandler(entityHandlerClass="CrosierSource\CrosierLibRadxBundle\EntityHandler\Fiscal\NotaFiscalVendaEntityHandler")
  39.  *
  40.  * @ORM\Entity(repositoryClass="CrosierSource\CrosierLibRadxBundle\Repository\Fiscal\NotaFiscalVendaRepository")
  41.  * @ORM\Table(name="fis_nf_venda")
  42.  */
  43. class NotaFiscalVenda implements EntityId
  44. {
  45.     use EntityIdTrait;
  46.     /**
  47.      *
  48.      * @ORM\ManyToOne(targetEntity="CrosierSource\CrosierLibRadxBundle\Entity\Fiscal\NotaFiscal")
  49.      * @ORM\JoinColumn(name="nota_fiscal_id", nullable=true)
  50.      *
  51.      * @var $notaFiscal null|NotaFiscal
  52.      */
  53.     public ?NotaFiscal $notaFiscal null;
  54.     /**
  55.      *
  56.      * @ORM\ManyToOne(targetEntity="CrosierSource\CrosierLibRadxBundle\Entity\Vendas\Venda")
  57.      * @ORM\JoinColumn(name="venda_id", nullable=false)
  58.      *
  59.      * @var null|Venda
  60.      */
  61.     public ?Venda $venda null;
  62.     /**
  63.      * @return NotaFiscal|null
  64.      */
  65.     public function getNotaFiscal(): ?NotaFiscal
  66.     {
  67.         return $this->notaFiscal;
  68.     }
  69.     /**
  70.      * @param NotaFiscal|null $notaFiscal
  71.      * @return NotaFiscalVenda
  72.      */
  73.     public function setNotaFiscal(?NotaFiscal $notaFiscal): NotaFiscalVenda
  74.     {
  75.         $this->notaFiscal $notaFiscal;
  76.         return $this;
  77.     }
  78.     /**
  79.      * @return Venda|null
  80.      */
  81.     public function getVenda(): ?Venda
  82.     {
  83.         return $this->venda;
  84.     }
  85.     /**
  86.      * @param Venda|null $venda
  87.      * @return NotaFiscalVenda
  88.      */
  89.     public function setVenda(?Venda $venda): NotaFiscalVenda
  90.     {
  91.         $this->venda $venda;
  92.         return $this;
  93.     }
  94. }