src/Entity/Cgu.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\CguRepository;
  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"={"cgu:read"}, "swagger_definition_name"="Read"},
  11.  *     denormalizationContext={"groups"={"cgu: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=CguRepository::class)
  24.  */
  25. class Cgu
  26. {
  27.     /**
  28.      * @ORM\Id
  29.      * @ORM\GeneratedValue
  30.      * @ORM\Column(type="integer")
  31.      * @Groups({
  32.      *   "cgu:read",
  33.      *   "abstract-collaborator:read",
  34.      *   "agent:read"
  35.      * })
  36.      */
  37.     private int $id;
  38.     /**
  39.      * @ORM\Column(type="string", length=100)
  40.      * @Groups({
  41.      *   "cgu:read",
  42.      *   "abstract-collaborator:read",
  43.      *   "agent:read"
  44.      * })
  45.      */
  46.     private string $ipAddress;
  47.     /**
  48.      * @ORM\Column(type="string", length=255, nullable=true)
  49.      * @Groups({
  50.      *   "cgu:read",
  51.      *   "abstract-collaborator:read",
  52.      *   "agent:read"
  53.      * })
  54.      */
  55.     private string $browser;
  56.     /**
  57.      * @ORM\Column(type="boolean")
  58.      * @Groups({
  59.      *   "cgu:read",
  60.      *   "abstract-collaborator:read",
  61.      *   "agent:read"
  62.      * })
  63.      */
  64.     private bool $isAccepted;
  65.     /**
  66.      * @ORM\Column(type="datetime", nullable=true)
  67.      * @Groups({
  68.      *   "cgu:read",
  69.      *   "abstract-collaborator:read",
  70.      *   "agent:read"
  71.      * })
  72.      */
  73.     private \DateTimeInterface $acceptedAt;
  74.     /**
  75.      * @ORM\OneToOne(targetEntity=AbstractCollaborator::class, inversedBy="cgu")
  76.      * @ORM\JoinColumn(nullable=false)
  77.      * @Groups({
  78.      *   "cgu:read"
  79.      * })
  80.      */
  81.     private AbstractCollaborator $collaborator;
  82.     public function getId(): ?int
  83.     {
  84.         return $this->id;
  85.     }
  86.     public function getIpAddress(): ?string
  87.     {
  88.         return $this->ipAddress;
  89.     }
  90.     public function setIpAddress(string $ipAddress): self
  91.     {
  92.         $this->ipAddress $ipAddress;
  93.         return $this;
  94.     }
  95.     public function getBrowser(): ?string
  96.     {
  97.         return $this->browser;
  98.     }
  99.     public function setBrowser(?string $browser): self
  100.     {
  101.         $this->browser $browser;
  102.         return $this;
  103.     }
  104.     public function getIsAccepted(): ?bool
  105.     {
  106.         return $this->isAccepted;
  107.     }
  108.     public function setIsAccepted(bool $isAccepted): self
  109.     {
  110.         $this->isAccepted $isAccepted;
  111.         return $this;
  112.     }
  113.     public function getAcceptedAt(): ?\DateTimeInterface
  114.     {
  115.         return $this->acceptedAt;
  116.     }
  117.     public function setAcceptedAt(?\DateTimeInterface $acceptedAt): self
  118.     {
  119.         $this->acceptedAt $acceptedAt;
  120.         return $this;
  121.     }
  122.     public function getCollaborator(): ?AbstractCollaborator
  123.     {
  124.         return $this->collaborator;
  125.     }
  126.     public function setCollaborator(AbstractCollaborator $collaborator): self
  127.     {
  128.         $this->collaborator $collaborator;
  129.         return $this;
  130.     }
  131. }