src/Entity/Nationality.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\NationalityRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. /**
  8.  * @ApiResource(
  9.  *     security= "is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')",
  10.  *     normalizationContext={"groups"={"nationality:read"}, "swagger_definition_name"="Read"},
  11.  *     denormalizationContext={"groups"={"nationality:write"}, "swagger_definition_name"="Write"},
  12.  *     itemOperations={
  13.  *          "get"
  14.  *     },
  15.  *     collectionOperations={
  16.  *          "get",
  17.  *     },
  18.  *     attributes={
  19.  *          "pagination_items_per_page"=10,
  20.  *          "formats"={"jsonld", "json", "html", "jsonhal", "csv"={"text/csv"} }
  21.  *     }
  22.  * )
  23.  * @ORM\Entity(repositoryClass=NationalityRepository::class)
  24.  */
  25. class Nationality
  26. {
  27.     /**
  28.      * @ORM\Id
  29.      * @ORM\GeneratedValue
  30.      * @ORM\Column(type="integer")
  31.      *
  32.      * @Groups({
  33.      *   "directory:collaborator:search",
  34.      *   "directory:people:search",
  35.      *   "agent:read",
  36.      *   "candidate:read",
  37.      *   "nationality:read",
  38.      * })
  39.      */
  40.     private $id;
  41.     /**
  42.      * @ORM\Column(type="string", length=100)
  43.      * @Groups({
  44.      *   "directory:collaborator:search",
  45.      *   "directory:people:search",
  46.      *   "agent:read",
  47.      *   "candidate:read",
  48.      *   "nationality:read",
  49.      * })
  50.      */
  51.     private $name;
  52.     /**
  53.      * @ORM\Column(type="string", length=100)
  54.      */
  55.     private $code;
  56.     public function getId(): ?int
  57.     {
  58.         return $this->id;
  59.     }
  60.     public function setId(int $id): void
  61.     {
  62.         $this->id $id;
  63.     }
  64.     public function getName(): ?string
  65.     {
  66.         return $this->name;
  67.     }
  68.     public function setName(string $name): self
  69.     {
  70.         $this->name $name;
  71.         return $this;
  72.     }
  73.     public function getCode(): ?string
  74.     {
  75.         return $this->code;
  76.     }
  77.     public function setCode(string $code): self
  78.     {
  79.         $this->code $code;
  80.         return $this;
  81.     }
  82. }