src/App/Entity/AutomatedEmailNotificationDefinition/AutomatedEmailNotificationDefinition.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\AutomatedEmailNotificationDefinition;
  3. use App\Entity\Notification;
  4. use DateTime;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Exception;
  9. /**
  10. * @ORM\Entity
  11. *
  12. * @ORM\Table(name="automated_email_notification_definitions")
  13. */
  14. class AutomatedEmailNotificationDefinition
  15. {
  16. /** @throws Exception */
  17. public function __construct(
  18. int $id,
  19. ?DateTime $lastSentAt
  20. ) {
  21. $this->id = $id;
  22. $this->automatedEmailNotificationDefinitionTextContents = new ArrayCollection();
  23. $this->lastSentAt = $lastSentAt;
  24. $this->notification = null;
  25. }
  26. /**
  27. * @ORM\Column(type="integer", nullable=false)
  28. *
  29. * @ORM\Id
  30. */
  31. private int $id;
  32. public function getId(): int
  33. {
  34. return $this->id;
  35. }
  36. /**
  37. * @var Collection|AutomatedEmailNotificationDefinitionTextContent[]
  38. *
  39. * @ORM\OneToMany(
  40. * targetEntity="\App\Entity\AutomatedEmailNotificationDefinition\AutomatedEmailNotificationDefinitionTextContent",
  41. * mappedBy="automatedEmailNotificationDefinition",
  42. * cascade={"persist", "remove"}
  43. * )
  44. */
  45. private Collection $automatedEmailNotificationDefinitionTextContents;
  46. /** @return Collection|AutomatedEmailNotificationDefinitionTextContent[] */
  47. public function getAutomatedEmailNotificationDefinitionTextContents(): Collection
  48. {
  49. return $this->automatedEmailNotificationDefinitionTextContents;
  50. }
  51. public function addAutomatedEmailNotificationDefinitionTextContent(AutomatedEmailNotificationDefinitionTextContent $content): void
  52. {
  53. $this->getAutomatedEmailNotificationDefinitionTextContents()->add($content);
  54. }
  55. /**
  56. * @ORM\Column(type="datetime", nullable=true)
  57. */
  58. private ?DateTime $lastSentAt;
  59. public function getLastSentAt(): ?DateTime
  60. {
  61. return $this->lastSentAt;
  62. }
  63. public function setLastSentAt(?DateTime $lastSentAt): void
  64. {
  65. $this->lastSentAt = $lastSentAt;
  66. }
  67. /**
  68. * @ORM\OneToOne(targetEntity="App\Entity\Notification", inversedBy="automatedEmailNotificationDefinition", cascade={"persist"})
  69. *
  70. * @ORM\JoinColumn(name="notifications_id", referencedColumnName="id", onDelete="CASCADE")
  71. */
  72. private ?Notification $notification;
  73. public function getNotification(): ?Notification
  74. {
  75. return $this->notification;
  76. }
  77. public function setNotification(?Notification $notification): void
  78. {
  79. $this->notification = $notification;
  80. }
  81. }