src/Entity/ApiMailRecipient.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ApiMailRecipientRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use JMS\Serializer\Annotation as Serializer;
  6. use JMS\Serializer\Annotation\Expose;
  7. use JMS\Serializer\Annotation\Groups;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10. * Destinataires pour un envoi de mail
  11. *
  12. * @ORM\Entity(repositoryClass=ApiMailRecipientRepository::class)
  13. *
  14. * @Serializer\ExclusionPolicy("ALL")
  15. */
  16. class ApiMailRecipient
  17. {
  18. /**
  19. * @ORM\Id
  20. * @ORM\GeneratedValue
  21. * @ORM\Column(type="integer")
  22. *
  23. * @Expose
  24. * @Groups({"get"})
  25. */
  26. private ?int $id = NULL;
  27. /**
  28. * Nom du destinataire
  29. *
  30. * @ORM\Column(type="string", length=255)
  31. *
  32. * @Assert\NotBlank
  33. *
  34. * @Expose
  35. * @Groups({"get","post"})
  36. */
  37. private ?string $toName = NULL;
  38. /**
  39. * Email du destinataire
  40. * @ORM\Column(type="string", length=255)
  41. *
  42. * @Assert\NotBlank
  43. * @Assert\Email
  44. *
  45. * @Expose
  46. * @Groups({"get","post"})
  47. */
  48. private ?string $toEmail = NULL;
  49. /**
  50. * Paramètres liés au destinataire (adresse, points, ...)
  51. * @ORM\Column(type="json", nullable=true)
  52. *
  53. * @Expose
  54. * @Groups({"post"})
  55. *
  56. */
  57. private ?array $params = [];
  58. /**
  59. * Pieces joints
  60. * @ORM\Column(type="json", nullable=true)
  61. *
  62. */
  63. private ?array $attachments = [];
  64. /**
  65. * @ORM\ManyToOne(targetEntity=ApiMailRequest::class, inversedBy="recipients")
  66. * @ORM\JoinColumn(nullable=false)
  67. */
  68. private ?ApiMailRequest $apiMailRequest = NULL;
  69. /**
  70. * Recupère la langue du user pour la traduction des mails
  71. * @ORM\Column(type="string", length=255)
  72. *
  73. * @Expose
  74. * @Groups({"get","post"})
  75. */
  76. private ?string $language = NULL;
  77. public function getId(): ?int
  78. {
  79. return $this->id;
  80. }
  81. public function getToName(): string
  82. {
  83. return $this->toName;
  84. }
  85. public function setToName(string $toName): self
  86. {
  87. $this->toName = $toName;
  88. return $this;
  89. }
  90. public function getToEmail(): string
  91. {
  92. return $this->toEmail;
  93. }
  94. public function setToEmail(string $toEmail): self
  95. {
  96. $this->toEmail = $toEmail;
  97. return $this;
  98. }
  99. public function getParams(): ?array
  100. {
  101. return $this->params;
  102. }
  103. public function setParams(?array $params): self
  104. {
  105. $this->params = $params;
  106. return $this;
  107. }
  108. public function getAttachements(): ?array
  109. {
  110. return $this->attachments;
  111. }
  112. public function setAttachements(?array $attachments): self
  113. {
  114. $this->attachments = $attachments;
  115. return $this;
  116. }
  117. public function getApiMailRequest(): ApiMailRequest
  118. {
  119. return $this->apiMailRequest;
  120. }
  121. public function setApiMailRequest(?ApiMailRequest $apiMailRequest): self
  122. {
  123. $this->apiMailRequest = $apiMailRequest;
  124. return $this;
  125. }
  126. public function getLanguage(): string
  127. {
  128. return $this->language;
  129. }
  130. public function setLanguage(string $lanquage): self
  131. {
  132. $this->language = $lanquage;
  133. return $this;
  134. }
  135. }