<?php
namespace App\Entity;
use Symfony\Component\Serializer\Annotation\Groups;
use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\ProxyContactRepository;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ApiResource(
* normalizationContext={"groups"={"contact-proxy:read"}, "swagger_definition_name"="Read"},
* denormalizationContext={"groups"={"contact-proxy:write"}, "swagger_definition_name"="Write", "skip_null_values" = true},
* )
* @ORM\Entity(repositoryClass=ProxyContactRepository::class)
*/
class ProxyContact
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({
* "contact:read",
* "mandate:read",
* "contact-proxy:read"
* })
*/
private int $id;
/**
* @ORM\Column(type="string", length=255)
* @Groups({
* "contact:read","contact:write","contact:put",
* "mandate:read",
* "contact-proxy:read","contact-proxy:write","contact-proxy:put"
* })
*/
private string $firstName;
/**
* @ORM\Column(type="string", length=255)
* @Groups({
* "contact:read","contact:write","contact:put",
* "mandate:read",
* "contact-proxy:read","contact-proxy:write","contact-proxy:put"
* })
*/
private string $lastName;
/**
* @ORM\Column(type="string", length=255)
* @Groups({
* "contact:read","contact:write","contact:put",
* "mandate:read",
* "contact-proxy:read","contact-proxy:write","contact-proxy:put"
* })
*/
private string $phone;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Assert\Email
* @Groups({
* "contact:read","contact:write","contact:put",
* "mandate:read",
* "contact-proxy:read","contact-proxy:write","contact-proxy:put"
* })
*/
private ?string $email = null;
public function getId(): ?int
{
return $this->id;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(string $firstName): self
{
$this->firstName = $firstName;
return $this;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(string $lastName): self
{
$this->lastName = $lastName;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
/**
* @return string
*/
public function getFullName(): string
{
return sprintf('%s %s', ucfirst($this->firstName), strtoupper($this->lastName));
}
}