src/Entity/AgentsOptions.php line 32

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use Symfony\Component\Serializer\Annotation\Groups;
  5. use App\Repository\AgentsOptionsRepository;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ApiResource(
  9.  *     security = "is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')",
  10.  *     normalizationContext = { "groups" = {"AgentsOptions:read"}, "swagger_definition_name" = "Read" },
  11.  *     denormalizationContext = { "groups" = {"AgentsOptions:write"}, "swagger_definition_name" = "Write" },
  12.  *
  13.  *      itemOperations={
  14.  *         "get",
  15.  *          "put"= {
  16.  *                  "denormalization_context"={"groups"={"AgentsOptions:put"}},
  17.  *                  "access_control"="is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')",
  18.  *              },
  19.  *      },
  20.  *     collectionOperations = {
  21.  *          "get",
  22.  *          "post" = {
  23.  *               "security"="is_granted('ROLE_MANAGER')",
  24.  *          },
  25.  *      }
  26.  * )
  27.  * @ORM\Entity(repositoryClass=AgentsOptionsRepository::class)
  28.  */
  29. class AgentsOptions
  30. {
  31.     /**
  32.      * @ORM\Id
  33.      * @ORM\GeneratedValue
  34.      * @ORM\Column(type="integer")
  35.      *
  36.      * @Groups({
  37.      *   "directory:collaborator:search",
  38.      *   "agent:read","siege:put","siege:write",
  39.      *   "AgentsOptions:put","AgentsOptions:read", "contact:read"
  40.      * })
  41.      */
  42.     private $id;
  43.     /**
  44.      * @ORM\ManyToOne(targetEntity=Agent::class, inversedBy="agentOptions")
  45.      *
  46.      */
  47.     private $agent;
  48.     /**
  49.      * @ORM\ManyToOne(targetEntity=Option::class, inversedBy="agentsOptions")
  50.      *
  51.      * @Groups({
  52.      *   "directory:collaborator:search",
  53.      *   "agent:read",
  54.      *   "milkiya:read",
  55.      *   "AgentsOptions:read",
  56.      *   "contact:read"
  57.      * })
  58.      */
  59.     private $option;
  60.     /**
  61.      * @ORM\Column(type="string", length=255)
  62.      *
  63.      * @Groups({
  64.      *   "directory:collaborator:search",
  65.      *   "agent:read","siege:put","siege:write",
  66.      *   "milkiya:read",
  67.      *   "AgentsOptions:read",
  68.      *   "AgentsOptions:put",
  69.      *   "agent:put",
  70.      *   "contact:read"
  71.      * })
  72.      */
  73.     private $optionValue;
  74.     public function getId(): ?int
  75.     {
  76.         return $this->id;
  77.     }
  78.     public function getAgent(): ?Agent
  79.     {
  80.         return $this->agent;
  81.     }
  82.     public function setAgent(?Agent $agent): self
  83.     {
  84.         $this->agent $agent;
  85.         return $this;
  86.     }
  87.     public function getOption(): ?Option
  88.     {
  89.         return $this->option;
  90.     }
  91.     public function setOption(?Option $option): self
  92.     {
  93.         $this->option $option;
  94.         return $this;
  95.     }
  96.     public function getOptionValue(): ?string
  97.     {
  98.         return $this->optionValue;
  99.     }
  100.     public function setOptionValue(string $optionValue): self
  101.     {
  102.         $this->optionValue $optionValue;
  103.         return $this;
  104.     }
  105. }