<?php
namespace App\Entity\Common;
use App\Entity\AbstractEntity;
use App\Entity\Gestiform\Admin\ModelsDocument\Template;
use App\Entity\Gestiform\Formations\Dossier\Dossier;
use App\Entity\Gestiform\Users\Personne;
use App\Repository\Common\HistoriqueEmailRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=HistoriqueEmailRepository::class)
*/
class HistoriqueEmail extends AbstractEntity
{
/**
* @ORM\Column(name="sendTo",type="string", length=255,nullable=true)
*/
private ?string $to = null;
/**
* @ORM\Column(name="sendFrom",type="string", length=255,nullable=true)
*/
private ?string $from = null;
/**
* @ORM\Column(type="string", length=255,nullable=true)
*/
private ?string $objet = null;
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $content = null;
/**
* @ORM\ManyToOne(targetEntity=Dossier::class, inversedBy="historiqueEmails")
* @ORM\JoinColumn(nullable=true)
*/
private ?Dossier $dossier = null;
/**
* @ORM\ManyToOne(targetEntity=Personne::class, inversedBy="historiqueEmails")
* @ORM\JoinColumn(nullable=true)
*/
private ?Personne $personne = null;
/**
* @ORM\ManyToOne(targetEntity=Template::class)
* @ORM\JoinColumn(nullable=true)
*/
private ?Template $template = null;
/**
* @ORM\OneToMany(targetEntity=Attachment::class, cascade={"all"}, mappedBy="historiqueEmail")
*/
private Collection $attachments;
public function __construct()
{
$this->attachments = new ArrayCollection();
}
public function getTo(): ?string
{
return $this->to;
}
public function setTo(?string $to): self
{
$this->to = $to;
return $this;
}
public function getFrom(): ?string
{
return $this->from;
}
public function setFrom(?string $from): self
{
$this->from = $from;
return $this;
}
public function getObjet(): ?string
{
return $this->objet;
}
public function setObjet(?string $objet): self
{
$this->objet = $objet;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): self
{
$this->content = $content;
return $this;
}
public function getDossier(): ?Dossier
{
return $this->dossier;
}
public function setDossier(?Dossier $dossier): self
{
$this->dossier = $dossier;
return $this;
}
public function getPersonne(): ?Personne
{
return $this->personne;
}
public function setPersonne(?Personne $personne): self
{
$this->personne = $personne;
return $this;
}
public function getTemplate(): ?Template
{
return $this->template;
}
public function setTemplate(?Template $template): self
{
$this->template = $template;
return $this;
}
/**
* @return Collection<int, Attachment>
*/
public function getAttachments(): Collection
{
return $this->attachments;
}
public function addAttachment(Attachment $attachment): self
{
if (!$this->attachments->contains($attachment)) {
$this->attachments->add($attachment);
$attachment->setHistoriqueEmail($this);
}
return $this;
}
public function removeAttachment(Attachment $attachment): self
{
if ($this->attachments->removeElement($attachment)) {
// set the owning side to null (unless already changed)
if ($attachment->getHistoriqueEmail() === $this) {
$attachment->setHistoriqueEmail(null);
}
}
return $this;
}
}