src/Entity/EmailConfiguration.php line 15

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EmailConfigurationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints\Email;
  8. use Symfony\Component\Validator\Constraints\GreaterThan;
  9. use Symfony\Component\Validator\Constraints\NotBlank;
  10. use Symfony\Component\Validator\Constraints\Valid;
  11. #[ORM\Entity(repositoryClassEmailConfigurationRepository::class)]
  12. class EmailConfiguration
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\Column(length255nullabletrue)]
  19.     #[NotBlank(groups: ['company'])]
  20.     private ?string $host null;
  21.     #[ORM\Column(length50nullabletrue)]
  22.     #[NotBlank(groups: ['company'])]
  23.     #[Email(groups: ['company'])]
  24.     private ?string $email null;
  25.     #[ORM\Column(length255nullabletrue)]
  26.     #[NotBlank(groups: ['company'])]
  27.     private ?string $password null;
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $name null;
  30.     #[ORM\Column(nullabletrue)]
  31.     #[NotBlank(groups: ['company'])]
  32.     #[GreaterThan(0groups: ['company'])]
  33.     private ?int $port null;
  34.     #[ORM\OneToOne(inversedBy'emailConfiguration'cascade: ['persist''remove'])]
  35.     #[ORM\JoinColumn(nullablefalse)]
  36.     private ?SriInfo $SriInfo null;
  37.     #[ORM\Column(nullabletrue)]
  38.     private ?bool $autoSend null;
  39.     #[ORM\OneToMany(mappedBy'configuration'targetEntityEmailTemplate::class, cascade: ['persist'], orphanRemovaltrue)]
  40.     #[Valid()]
  41.     private Collection $emailTemplates;
  42.     #[ORM\Column(nullabletrue)]
  43.     private ?bool $useDefault null;
  44.     #[ORM\Column(length255nullabletrue)]
  45.     private ?string $sendCopyTo null;
  46.     public function __construct()
  47.     {
  48.         $this->emailTemplates = new ArrayCollection();
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getHost(): ?string
  55.     {
  56.         return $this->host;
  57.     }
  58.     public function setHost(?string $host): self
  59.     {
  60.         $this->host $host;
  61.         return $this;
  62.     }
  63.     public function getEmail(): ?string
  64.     {
  65.         return $this->email;
  66.     }
  67.     public function setEmail(?string $email): self
  68.     {
  69.         $this->email $email;
  70.         return $this;
  71.     }
  72.     public function getPassword(): ?string
  73.     {
  74.         return $this->password;
  75.     }
  76.     public function setPassword(?string $password): self
  77.     {
  78.         $this->password $password;
  79.         return $this;
  80.     }
  81.     public function getName(): ?string
  82.     {
  83.         return $this->name;
  84.     }
  85.     public function setName(?string $name): self
  86.     {
  87.         $this->name $name;
  88.         return $this;
  89.     }
  90.     public function getPort(): ?int
  91.     {
  92.         return $this->port;
  93.     }
  94.     public function setPort(?int $port): self
  95.     {
  96.         $this->port $port;
  97.         return $this;
  98.     }
  99.     public function getSriInfo(): ?SriInfo
  100.     {
  101.         return $this->SriInfo;
  102.     }
  103.     public function setSriInfo(SriInfo $SriInfo): self
  104.     {
  105.         $this->SriInfo $SriInfo;
  106.         return $this;
  107.     }
  108.     public function isAutoSend(): ?bool
  109.     {
  110.         return $this->autoSend;
  111.     }
  112.     public function setAutoSend(?bool $autoSend): self
  113.     {
  114.         $this->autoSend $autoSend;
  115.         return $this;
  116.     }
  117.     /**
  118.      * @return Collection<int, EmailTemplate>
  119.      */
  120.     public function getEmailTemplates(): Collection
  121.     {
  122.         return $this->emailTemplates;
  123.     }
  124.     public function addEmailTemplate(EmailTemplate $emailTemplate): self
  125.     {
  126.         if (!$this->emailTemplates->contains($emailTemplate)) {
  127.             $this->emailTemplates->add($emailTemplate);
  128.             $emailTemplate->setConfiguration($this);
  129.         }
  130.         return $this;
  131.     }
  132.     public function removeEmailTemplate(EmailTemplate $emailTemplate): self
  133.     {
  134.         if ($this->emailTemplates->removeElement($emailTemplate)) {
  135.             // set the owning side to null (unless already changed)
  136.             if ($emailTemplate->getConfiguration() === $this) {
  137.                 $emailTemplate->setConfiguration(null);
  138.             }
  139.         }
  140.         return $this;
  141.     }
  142.     public function isUseDefault(): ?bool
  143.     {
  144.         return $this->useDefault;
  145.     }
  146.     public function setUseDefault(?bool $useDefault): self
  147.     {
  148.         $this->useDefault $useDefault;
  149.         return $this;
  150.     }
  151.     public function getSendCopyTo(): ?string
  152.     {
  153.         return $this->sendCopyTo;
  154.     }
  155.     public function setSendCopyTo(?string $sendCopyTo): static
  156.     {
  157.         $this->sendCopyTo $sendCopyTo;
  158.         return $this;
  159.     }
  160. }