src/Entity/Common/HistoriqueEmail.php line 17

  1. <?php
  2. namespace App\Entity\Common;
  3. use App\Entity\AbstractEntity;
  4. use App\Entity\Gestiform\Admin\ModelsDocument\Template;
  5. use App\Entity\Gestiform\Formations\Dossier\Dossier;
  6. use App\Entity\Gestiform\Users\Personne;
  7. use App\Repository\Common\HistoriqueEmailRepository;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. #[ORM\Entity(repositoryClassHistoriqueEmailRepository::class)]
  12. class HistoriqueEmail extends AbstractEntity
  13. {
  14.     #[ORM\Column(name'sendTo'type'string'length255nullabletrue)]
  15.     private ?string $to null;
  16.     #[ORM\Column(name'sendFrom'type'string'length255nullabletrue)]
  17.     private ?string $from null;
  18.     #[ORM\Column(type'string'length255nullabletrue)]
  19.     private ?string $objet null;
  20.     #[ORM\Column(type'text'nullabletrue)]
  21.     private ?string $content null;
  22.     #[ORM\JoinColumn(nullabletrue)]
  23.     #[ORM\ManyToOne(targetEntityDossier::class, inversedBy'historiqueEmails')]
  24.     private ?Dossier $dossier null;
  25.     #[ORM\JoinColumn(nullabletrue)]
  26.     #[ORM\ManyToOne(targetEntityPersonne::class, inversedBy'historiqueEmails')]
  27.     private ?Personne $personne null;
  28.     #[ORM\JoinColumn(nullabletrue)]
  29.     #[ORM\ManyToOne(targetEntityTemplate::class)]
  30.     private ?Template $template null;
  31.     #[ORM\OneToMany(mappedBy'historiqueEmail'targetEntityAttachment::class, cascade: ['all'])]
  32.     private Collection $attachments;
  33.     public function __construct()
  34.     {
  35.         $this->attachments = new ArrayCollection();
  36.     }
  37.     public function getTo(): ?string
  38.     {
  39.         return $this->to;
  40.     }
  41.     public function setTo(?string $to): self
  42.     {
  43.         $this->to $to;
  44.         return $this;
  45.     }
  46.     public function getFrom(): ?string
  47.     {
  48.         return $this->from;
  49.     }
  50.     public function setFrom(?string $from): self
  51.     {
  52.         $this->from $from;
  53.         return $this;
  54.     }
  55.     public function getObjet(): ?string
  56.     {
  57.         return $this->objet;
  58.     }
  59.     public function setObjet(?string $objet): self
  60.     {
  61.         $this->objet $objet;
  62.         return $this;
  63.     }
  64.     public function getContent(): ?string
  65.     {
  66.         return $this->content;
  67.     }
  68.     public function setContent(?string $content): self
  69.     {
  70.         $this->content $content;
  71.         return $this;
  72.     }
  73.     public function getDossier(): ?Dossier
  74.     {
  75.         return $this->dossier;
  76.     }
  77.     public function setDossier(?Dossier $dossier): self
  78.     {
  79.         $this->dossier $dossier;
  80.         return $this;
  81.     }
  82.     public function getPersonne(): ?Personne
  83.     {
  84.         return $this->personne;
  85.     }
  86.     public function setPersonne(?Personne $personne): self
  87.     {
  88.         $this->personne $personne;
  89.         return $this;
  90.     }
  91.     public function getTemplate(): ?Template
  92.     {
  93.         return $this->template;
  94.     }
  95.     public function setTemplate(?Template $template): self
  96.     {
  97.         $this->template $template;
  98.         return $this;
  99.     }
  100.     /**
  101.      * @return Collection<int, Attachment>
  102.      */
  103.     public function getAttachments(): Collection
  104.     {
  105.         return $this->attachments;
  106.     }
  107.     public function addAttachment(Attachment $attachment): self
  108.     {
  109.         if (!$this->attachments->contains($attachment)) {
  110.             $this->attachments->add($attachment);
  111.             $attachment->setHistoriqueEmail($this);
  112.         }
  113.         return $this;
  114.     }
  115.     public function removeAttachment(Attachment $attachment): self
  116.     {
  117.         // set the owning side to null (unless already changed)
  118.         if ($this->attachments->removeElement($attachment) && $attachment->getHistoriqueEmail() === $this) {
  119.             $attachment->setHistoriqueEmail(null);
  120.         }
  121.         return $this;
  122.     }
  123. }