<?php
namespace App\Entity\AutomatedEmailNotificationDefinition;
use App\Entity\Notification;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Exception;
/**
* @ORM\Entity
*
* @ORM\Table(name="automated_email_notification_definitions")
*/
class AutomatedEmailNotificationDefinition
{
/** @throws Exception */
public function __construct(
int $id,
?DateTime $lastSentAt
) {
$this->id = $id;
$this->automatedEmailNotificationDefinitionTextContents = new ArrayCollection();
$this->lastSentAt = $lastSentAt;
$this->notification = null;
}
/**
* @ORM\Column(type="integer", nullable=false)
*
* @ORM\Id
*/
private int $id;
public function getId(): int
{
return $this->id;
}
/**
* @var Collection|AutomatedEmailNotificationDefinitionTextContent[]
*
* @ORM\OneToMany(
* targetEntity="\App\Entity\AutomatedEmailNotificationDefinition\AutomatedEmailNotificationDefinitionTextContent",
* mappedBy="automatedEmailNotificationDefinition",
* cascade={"persist", "remove"}
* )
*/
private Collection $automatedEmailNotificationDefinitionTextContents;
/** @return Collection|AutomatedEmailNotificationDefinitionTextContent[] */
public function getAutomatedEmailNotificationDefinitionTextContents(): Collection
{
return $this->automatedEmailNotificationDefinitionTextContents;
}
public function addAutomatedEmailNotificationDefinitionTextContent(AutomatedEmailNotificationDefinitionTextContent $content): void
{
$this->getAutomatedEmailNotificationDefinitionTextContents()->add($content);
}
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private ?DateTime $lastSentAt;
public function getLastSentAt(): ?DateTime
{
return $this->lastSentAt;
}
public function setLastSentAt(?DateTime $lastSentAt): void
{
$this->lastSentAt = $lastSentAt;
}
/**
* @ORM\OneToOne(targetEntity="App\Entity\Notification", inversedBy="automatedEmailNotificationDefinition", cascade={"persist"})
*
* @ORM\JoinColumn(name="notifications_id", referencedColumnName="id", onDelete="CASCADE")
*/
private ?Notification $notification;
public function getNotification(): ?Notification
{
return $this->notification;
}
public function setNotification(?Notification $notification): void
{
$this->notification = $notification;
}
}