vendor/crosiersource/crosierlib-base/src/Entity/Base/Estado.php line 44

Open in your IDE?
  1. <?php
  2. namespace CrosierSource\CrosierLibBaseBundle\Entity\Base;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  6. use CrosierSource\CrosierLibBaseBundle\Doctrine\Annotations\EntityHandler;
  7. use CrosierSource\CrosierLibBaseBundle\Entity\EntityId;
  8. use CrosierSource\CrosierLibBaseBundle\Entity\EntityIdTrait;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. /**
  13.  * @ApiResource(
  14.  *       normalizationContext={"groups"={"estado","entityId"},"enable_max_depth"=true},
  15.  *       denormalizationContext={"groups"={"estado"},"enable_max_depth"=true},
  16.  *
  17.  *       itemOperations={
  18.  *            "get"={"path"="/bse/estado/{id}", "security"="is_granted('ROLE_ADMIN')"},
  19.  *            "put"={"path"="/bse/estado/{id}", "security"="is_granted('ROLE_ADMIN')"},
  20.  *            "delete"={"path"="/bse/estado/{id}", "security"="is_granted('ROLE_ADMIN')"}
  21.  *       },
  22.  *       collectionOperations={
  23.  *            "get"={"path"="/bse/estado", "security"="is_granted('ROLE_ADMIN')"},
  24.  *            "post"={"path"="/bse/estado", "security"="is_granted('ROLE_ADMIN')"}
  25.  *       },
  26.  *
  27.  *       attributes={
  28.  *            "pagination_items_per_page"=10,
  29.  *            "formats"={"jsonld", "csv"={"text/csv"}}
  30.  *       }
  31.  *   )
  32.  *
  33.  * @ApiFilter(OrderFilter::class, properties={"id", "UUID", "nome", "updated"}, arguments={"orderParameterName"="order"})
  34.  *
  35.  * @EntityHandler(entityHandlerClass="CrosierSource\CrosierLibBaseBundle\EntityHandler\Base\EstadoEntityHandler")
  36.  *
  37.  * @ORM\Entity(repositoryClass="CrosierSource\CrosierLibBaseBundle\Repository\Base\EstadoRepository")
  38.  * @ORM\Table(name="bse_uf")
  39.  * @author Carlos Eduardo Pauluk
  40.  */
  41. class Estado implements EntityId
  42. {
  43.     use EntityIdTrait;
  44.     /**
  45.      * @ORM\Column(name="nome", type="string", nullable=false, length=50)
  46.      * @Assert\NotBlank(message="O campo 'nome' deve ser informado")
  47.      * @Groups("estado")
  48.      * @var null|string
  49.      */
  50.     public ?string $nome null;
  51.     /**
  52.      * @ORM\Column(name="sigla", type="string", nullable=false, length=2)
  53.      * @Assert\NotBlank(message="O campo 'sigla' deve ser informado")
  54.      * @Groups("estado")
  55.      */
  56.     public ?string $sigla null;
  57.     /**
  58.      * @ORM\Column(name="codigo_IBGE", type="integer", nullable=false)
  59.      * @Assert\NotBlank(message="O campo 'codigoIBGE' deve ser informado")
  60.      * @Assert\Range(min = 0)
  61.      * @Groups("estado")
  62.      * @var null|int
  63.      */
  64.     public ?int $codigoIBGE null;
  65. }