src/Entity/Common/HistoriqueEmail.php line 17
<?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\JoinColumn(nullable: true)]
#[ORM\ManyToOne(targetEntity: Dossier::class, inversedBy: 'historiqueEmails')]
private ?Dossier $dossier = null;
#[ORM\JoinColumn(nullable: true)]
#[ORM\ManyToOne(targetEntity: Personne::class, inversedBy: 'historiqueEmails')]
private ?Personne $personne = null;
#[ORM\JoinColumn(nullable: true)]
#[ORM\ManyToOne(targetEntity: Template::class)]
private ?Template $template = null;
#[ORM\OneToMany(mappedBy: 'historiqueEmail', targetEntity: Attachment::class, cascade: ['all'])]
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
{
// set the owning side to null (unless already changed)
if ($this->attachments->removeElement($attachment) && $attachment->getHistoriqueEmail() === $this) {
$attachment->setHistoriqueEmail(null);
}
return $this;
}
}