<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\CguRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* security= "is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')",
* normalizationContext={"groups"={"cgu:read"}, "swagger_definition_name"="Read"},
* denormalizationContext={"groups"={"cgu:write"}, "swagger_definition_name"="Write"},
* itemOperations={
* "get"
* },
* collectionOperations={
* "get",
* },
* attributes={
* "pagination_items_per_page"=10,
* "formats"={"jsonld", "json", "html", "jsonhal", "csv"={"text/csv"} }
* }
* )
* @ORM\Entity(repositoryClass=CguRepository::class)
*/
class Cgu
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({
* "cgu:read",
* "abstract-collaborator:read",
* "agent:read"
* })
*/
private int $id;
/**
* @ORM\Column(type="string", length=100)
* @Groups({
* "cgu:read",
* "abstract-collaborator:read",
* "agent:read"
* })
*/
private string $ipAddress;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({
* "cgu:read",
* "abstract-collaborator:read",
* "agent:read"
* })
*/
private string $browser;
/**
* @ORM\Column(type="boolean")
* @Groups({
* "cgu:read",
* "abstract-collaborator:read",
* "agent:read"
* })
*/
private bool $isAccepted;
/**
* @ORM\Column(type="datetime", nullable=true)
* @Groups({
* "cgu:read",
* "abstract-collaborator:read",
* "agent:read"
* })
*/
private \DateTimeInterface $acceptedAt;
/**
* @ORM\OneToOne(targetEntity=AbstractCollaborator::class, inversedBy="cgu")
* @ORM\JoinColumn(nullable=false)
* @Groups({
* "cgu:read"
* })
*/
private AbstractCollaborator $collaborator;
public function getId(): ?int
{
return $this->id;
}
public function getIpAddress(): ?string
{
return $this->ipAddress;
}
public function setIpAddress(string $ipAddress): self
{
$this->ipAddress = $ipAddress;
return $this;
}
public function getBrowser(): ?string
{
return $this->browser;
}
public function setBrowser(?string $browser): self
{
$this->browser = $browser;
return $this;
}
public function getIsAccepted(): ?bool
{
return $this->isAccepted;
}
public function setIsAccepted(bool $isAccepted): self
{
$this->isAccepted = $isAccepted;
return $this;
}
public function getAcceptedAt(): ?\DateTimeInterface
{
return $this->acceptedAt;
}
public function setAcceptedAt(?\DateTimeInterface $acceptedAt): self
{
$this->acceptedAt = $acceptedAt;
return $this;
}
public function getCollaborator(): ?AbstractCollaborator
{
return $this->collaborator;
}
public function setCollaborator(AbstractCollaborator $collaborator): self
{
$this->collaborator = $collaborator;
return $this;
}
}