vendor/crosiersource/crosierlib-base/src/Entity/Security/Role.php line 48

Open in your IDE?
  1. <?php
  2. namespace CrosierSource\CrosierLibBaseBundle\Entity\Security;
  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 CrosierSource\CrosierLibBaseBundle\Doctrine\Annotations\EntityHandler;
  8. use CrosierSource\CrosierLibBaseBundle\Entity\EntityId;
  9. use CrosierSource\CrosierLibBaseBundle\Entity\EntityIdTrait;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Symfony\Component\Serializer\Annotation\Groups;
  12. /**
  13.  * Entidade 'Role'.
  14.  *
  15.  * @ApiResource(
  16.  *     normalizationContext={"groups"={"role","entityId"},"enable_max_depth"=true},
  17.  *     denormalizationContext={"groups"={"role"},"enable_max_depth"=true},
  18.  *
  19.  *     itemOperations={
  20.  *          "get"={"path"="/sec/role/{id}", "security"="is_granted('ROLE_ADMIN')"},
  21.  *          "put"={"path"="/sec/role/{id}", "security"="is_granted('ROLE_ADMIN')"},
  22.  *          "delete"={"path"="/sec/role/{id}", "security"="is_granted('ROLE_ADMIN')"}
  23.  *     },
  24.  *     collectionOperations={
  25.  *          "get"={"path"="/sec/role", "security"="is_granted('ROLE_ADMIN')"},
  26.  *          "post"={"path"="/sec/role", "security"="is_granted('ROLE_ADMIN')"}
  27.  *     },
  28.  *
  29.  *     attributes={
  30.  *          "pagination_items_per_page"=10,
  31.  *          "formats"={"jsonld", "csv"={"text/csv"}}
  32.  *     }
  33.  * )
  34.  *
  35.  * @ApiFilter(SearchFilter::class, properties={"role": "exact"})
  36.  * @ApiFilter(OrderFilter::class, properties={"id", "role", "updated"}, arguments={"orderParameterName"="order"})
  37.  *
  38.  * @EntityHandler(entityHandlerClass="CrosierSource\CrosierLibBaseBundle\EntityHandler\Security\RoleEntityHandler")
  39.  *
  40.  * @ORM\Entity(repositoryClass="\CrosierSource\CrosierLibBaseBundle\Repository\Security\RoleRepository")
  41.  * @ORM\Table(name="sec_role")
  42.  *
  43.  * @author Carlos Eduardo Pauluk
  44.  */
  45. class Role implements EntityId
  46. {
  47.     use EntityIdTrait;
  48.     /**
  49.      *
  50.      * @ORM\Column(name="role", type="string", length=90, unique=true)
  51.      * @Groups("role")
  52.      * @var null|string
  53.      */
  54.     public ?string $role null;
  55.     /**
  56.      *
  57.      * @ORM\Column(name="descricao", type="string", length=90)
  58.      * @Groups("role")
  59.      * @var null|string
  60.      */
  61.     public ?string $descricao null;
  62.     
  63.     public function getRole()
  64.     {
  65.         return $this->role;
  66.     }
  67.     public function setRole($role)
  68.     {
  69.         $this->role $role;
  70.     }
  71.     public function getDescricao()
  72.     {
  73.         return $this->descricao;
  74.     }
  75.     public function setDescricao($descricao)
  76.     {
  77.         $this->descricao $descricao;
  78.     }
  79. }