<?phpnamespace App\Entity;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity */class Mail{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") * * @var int */ protected $id; /** * @ORM\Column(type="datetime") * * @var \DateTime */ protected $date; /** * @ORM\Column(type="json") * * @var array */ protected $recipients; /** * @ORM\Column(type="string") * * @var string */ protected $subject; /** * @ORM\Column(type="text") * * @var string */ protected $body; /** * Mail constructor. */ public function __construct() { try { $this->date = new \DateTime(); } catch (\Exception $exception) { // If the date can't be set by default, simply ignore it } } public function getId(): int { return $this->id; } /** * @return Mail */ public function setId(int $id): self { $this->id = $id; return $this; } public function getDate(): \DateTime { return $this->date; } /** * @return Mail */ public function setDate(\DateTime $date): self { $this->date = $date; return $this; } public function getRecipients(): array { return $this->recipients; } /** * @return Mail */ public function setRecipients(array $recipients): self { $this->recipients = $recipients; return $this; } public function getSubject(): string { return $this->subject; } /** * @return Mail */ public function setSubject(string $subject): self { $this->subject = $subject; return $this; } public function getBody(): string { return $this->body; } /** * @return Mail */ public function setBody(string $body): self { $this->body = $body; return $this; } public function getHour() { return $this->getDate(); } public function getFirstRecipient(): string { return $this->recipients[0]; } public function getSecondaryRecipients(): array { $secondaryRecipients = $this->recipients; unset($secondaryRecipients[0]); return $secondaryRecipients; }}