<?php
namespace App\Entity;
use App\Repository\ApiMailRecipientRepository;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
use JMS\Serializer\Annotation\Expose;
use JMS\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Destinataires pour un envoi de mail
*
* @ORM\Entity(repositoryClass=ApiMailRecipientRepository::class)
*
* @Serializer\ExclusionPolicy("ALL")
*/
class ApiMailRecipient
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*
* @Expose
* @Groups({"get"})
*/
private ?int $id = NULL;
/**
* Nom du destinataire
*
* @ORM\Column(type="string", length=255)
*
* @Assert\NotBlank
*
* @Expose
* @Groups({"get","post"})
*/
private ?string $toName = NULL;
/**
* Email du destinataire
* @ORM\Column(type="string", length=255)
*
* @Assert\NotBlank
* @Assert\Email
*
* @Expose
* @Groups({"get","post"})
*/
private ?string $toEmail = NULL;
/**
* Paramètres liés au destinataire (adresse, points, ...)
* @ORM\Column(type="json", nullable=true)
*
* @Expose
* @Groups({"post"})
*
*/
private ?array $params = [];
/**
* Pieces joints
* @ORM\Column(type="json", nullable=true)
*
*/
private ?array $attachments = [];
/**
* @ORM\ManyToOne(targetEntity=ApiMailRequest::class, inversedBy="recipients")
* @ORM\JoinColumn(nullable=false)
*/
private ?ApiMailRequest $apiMailRequest = NULL;
/**
* Recupère la langue du user pour la traduction des mails
* @ORM\Column(type="string", length=255)
*
* @Expose
* @Groups({"get","post"})
*/
private ?string $language = NULL;
public function getId(): ?int
{
return $this->id;
}
public function getToName(): string
{
return $this->toName;
}
public function setToName(string $toName): self
{
$this->toName = $toName;
return $this;
}
public function getToEmail(): string
{
return $this->toEmail;
}
public function setToEmail(string $toEmail): self
{
$this->toEmail = $toEmail;
return $this;
}
public function getParams(): ?array
{
return $this->params;
}
public function setParams(?array $params): self
{
$this->params = $params;
return $this;
}
public function getAttachements(): ?array
{
return $this->attachments;
}
public function setAttachements(?array $attachments): self
{
$this->attachments = $attachments;
return $this;
}
public function getApiMailRequest(): ApiMailRequest
{
return $this->apiMailRequest;
}
public function setApiMailRequest(?ApiMailRequest $apiMailRequest): self
{
$this->apiMailRequest = $apiMailRequest;
return $this;
}
public function getLanguage(): string
{
return $this->language;
}
public function setLanguage(string $lanquage): self
{
$this->language = $lanquage;
return $this;
}
}