src/Entity/ProxyContact.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Symfony\Component\Serializer\Annotation\Groups;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. use App\Repository\ProxyContactRepository;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9.  *  @ApiResource(
  10.  *     normalizationContext={"groups"={"contact-proxy:read"}, "swagger_definition_name"="Read"},
  11.  *     denormalizationContext={"groups"={"contact-proxy:write"}, "swagger_definition_name"="Write", "skip_null_values" = true},
  12.  * )
  13.  * @ORM\Entity(repositoryClass=ProxyContactRepository::class)
  14.  */
  15. class ProxyContact
  16. {
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue
  20.      * @ORM\Column(type="integer")
  21.      * @Groups({
  22.      *   "contact:read",
  23.      *   "mandate:read",
  24.      *   "contact-proxy:read"
  25.      * })
  26.      */
  27.     private int $id;
  28.     /**
  29.      * @ORM\Column(type="string", length=255)
  30.      * @Groups({
  31.      *   "contact:read","contact:write","contact:put",
  32.      *   "mandate:read",
  33.      *   "contact-proxy:read","contact-proxy:write","contact-proxy:put"
  34.      * })
  35.      */
  36.     private string $firstName;
  37.     /**
  38.      * @ORM\Column(type="string", length=255)
  39.      * @Groups({
  40.      *   "contact:read","contact:write","contact:put",
  41.      *   "mandate:read",
  42.      *   "contact-proxy:read","contact-proxy:write","contact-proxy:put"
  43.      * })
  44.      */
  45.     private string $lastName;
  46.     /**
  47.      * @ORM\Column(type="string", length=255)
  48.      * @Groups({
  49.      *   "contact:read","contact:write","contact:put",
  50.      *   "mandate:read",
  51.      *   "contact-proxy:read","contact-proxy:write","contact-proxy:put"
  52.      * })
  53.      */
  54.     private string $phone;
  55.     /**
  56.      * @ORM\Column(type="string", length=255, nullable=true)
  57.      * @Assert\Email
  58.      * @Groups({
  59.      *   "contact:read","contact:write","contact:put",
  60.      *   "mandate:read",
  61.      *   "contact-proxy:read","contact-proxy:write","contact-proxy:put"
  62.      * })
  63.      */
  64.     private ?string $email null;
  65.     public function getId(): ?int
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getFirstName(): ?string
  70.     {
  71.         return $this->firstName;
  72.     }
  73.     public function setFirstName(string $firstName): self
  74.     {
  75.         $this->firstName $firstName;
  76.         return $this;
  77.     }
  78.     public function getLastName(): ?string
  79.     {
  80.         return $this->lastName;
  81.     }
  82.     public function setLastName(string $lastName): self
  83.     {
  84.         $this->lastName $lastName;
  85.         return $this;
  86.     }
  87.     public function getPhone(): ?string
  88.     {
  89.         return $this->phone;
  90.     }
  91.     public function setPhone(string $phone): self
  92.     {
  93.         $this->phone $phone;
  94.         return $this;
  95.     }
  96.     public function getEmail(): ?string
  97.     {
  98.         return $this->email;
  99.     }
  100.     public function setEmail(?string $email): self
  101.     {
  102.         $this->email $email;
  103.         return $this;
  104.     }
  105.     /**
  106.      * @return string
  107.      */
  108.     public function getFullName(): string
  109.     {
  110.         return sprintf('%s %s'ucfirst($this->firstName), strtoupper($this->lastName));
  111.     }
  112. }