<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
use App\Repository\AgentsOptionsRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ApiResource(
* security = "is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')",
* normalizationContext = { "groups" = {"AgentsOptions:read"}, "swagger_definition_name" = "Read" },
* denormalizationContext = { "groups" = {"AgentsOptions:write"}, "swagger_definition_name" = "Write" },
*
* itemOperations={
* "get",
* "put"= {
* "denormalization_context"={"groups"={"AgentsOptions:put"}},
* "access_control"="is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')",
* },
* },
* collectionOperations = {
* "get",
* "post" = {
* "security"="is_granted('ROLE_MANAGER')",
* },
* }
* )
* @ORM\Entity(repositoryClass=AgentsOptionsRepository::class)
*/
class AgentsOptions
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*
* @Groups({
* "directory:collaborator:search",
* "agent:read","siege:put","siege:write",
* "AgentsOptions:put","AgentsOptions:read", "contact:read"
* })
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=Agent::class, inversedBy="agentOptions")
*
*/
private $agent;
/**
* @ORM\ManyToOne(targetEntity=Option::class, inversedBy="agentsOptions")
*
* @Groups({
* "directory:collaborator:search",
* "agent:read",
* "milkiya:read",
* "AgentsOptions:read",
* "contact:read"
* })
*/
private $option;
/**
* @ORM\Column(type="string", length=255)
*
* @Groups({
* "directory:collaborator:search",
* "agent:read","siege:put","siege:write",
* "milkiya:read",
* "AgentsOptions:read",
* "AgentsOptions:put",
* "agent:put",
* "contact:read"
* })
*/
private $optionValue;
public function getId(): ?int
{
return $this->id;
}
public function getAgent(): ?Agent
{
return $this->agent;
}
public function setAgent(?Agent $agent): self
{
$this->agent = $agent;
return $this;
}
public function getOption(): ?Option
{
return $this->option;
}
public function setOption(?Option $option): self
{
$this->option = $option;
return $this;
}
public function getOptionValue(): ?string
{
return $this->optionValue;
}
public function setOptionValue(string $optionValue): self
{
$this->optionValue = $optionValue;
return $this;
}
}