src/Entity/CRM/MailMessage.php line 17
<?phpnamespace App\Entity\CRM;use App\Entity\CRM\MailingSend;use App\Repository\MailMessageRepository;use DateTime;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: MailMessageRepository::class)]#[ORM\Table(name: 'mail_message')]#[ORM\HasLifecycleCallbacks]class MailMessage{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[Assert\NotBlank]#[Assert\Length(max: 255)]#[ORM\Column(length: 255)]private string $subject = '';#[Assert\NotBlank]#[ORM\Column(name: 'content_html', type: Types::TEXT)]private string $contentHtml = '';#[ORM\Column(name: 'is_active', type: Types::BOOLEAN)]private bool $isActive = true;#[ORM\Column(name: 'created_at', type: Types::DATETIME_MUTABLE)]private DateTime $createdAt;#[ORM\Column(name: 'updated_at', type: Types::DATETIME_MUTABLE)]private DateTime $updatedAt;#[ORM\OneToMany(mappedBy: 'mailMessage', targetEntity: MailingSend::class)]private Collection $mailingSends;public function __construct(){$now = new DateTime('now');$this->createdAt = $now;$this->updatedAt = $now;$this->mailingSends = new ArrayCollection();}public function __toString(): string{return $this->id.' - '.$this->subject;}public function getId(): ?int{return $this->id;}public function getSubject(): string{return $this->subject;}public function setSubject(string $subject): self{$this->subject = trim($subject);return $this;}public function getContentHtml(): string{return $this->contentHtml;}public function setContentHtml(string $contentHtml): self{$this->contentHtml = $contentHtml;return $this;}public function isActive(): bool{return $this->isActive;}public function setIsActive(bool $isActive): self{$this->isActive = $isActive;return $this;}public function getCreatedAt(): DateTime{return $this->createdAt;}public function getUpdatedAt(): DateTime{return $this->updatedAt;}#[ORM\PrePersist]public function onPrePersist(): void{$now = new DateTime('now');$this->createdAt = $now;$this->updatedAt = $now;$this->subject = trim($this->subject);}#[ORM\PreUpdate]public function onPreUpdate(): void{$this->updatedAt = new DateTime('now');$this->subject = trim($this->subject);}/*** @return Collection<int, MailingSend>*/public function getMailingSends(): Collection{return $this->mailingSends;}public function addMailingSend(MailingSend $mailingSend): static{if (!$this->mailingSends->contains($mailingSend)) {$this->mailingSends->add($mailingSend);$mailingSend->setMailMessage($this);}return $this;}public function removeMailingSend(MailingSend $mailingSend): static{if ($this->mailingSends->removeElement($mailingSend)) {// set the owning side to null (unless already changed)if ($mailingSend->getMailMessage() === $this) {$mailingSend->setMailMessage(null);}}return $this;}}