src/JanusHercules/SelfServiceTrafficCampaign/Domain/Entity/SelfServiceTrafficCampaign.php line 15

Open in your IDE?
  1. <?php
  2. namespace JanusHercules\SelfServiceTrafficCampaign\Domain\Entity;
  3. use App\Entity\RecurrentJob;
  4. use App\Utility\DatabaseIdGenerator;
  5. use App\Utility\DateTimeUtility;
  6. use DateTime;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Exception;
  10. #[ORM\Entity]
  11. #[ORM\Table(name: 'self_service_traffic_campaigns')]
  12. class SelfServiceTrafficCampaign
  13. {
  14. /**
  15. * @throws Exception
  16. */
  17. public function __construct(
  18. ) {
  19. $this->createdAt = DateTimeUtility::createDateTimeUtc();
  20. }
  21. #[ORM\Id]
  22. #[ORM\GeneratedValue(strategy: 'CUSTOM')]
  23. #[ORM\CustomIdGenerator(class: DatabaseIdGenerator::class)]
  24. #[ORM\Column(
  25. type : Types::GUID,
  26. unique: true
  27. )]
  28. private ?string $id;
  29. public function getId(): ?string
  30. {
  31. return $this->id;
  32. }
  33. public function setId(?string $id): void
  34. {
  35. $this->id = $id;
  36. }
  37. #[ORM\Column(
  38. type : Types::DATETIME_MUTABLE,
  39. nullable: false
  40. )]
  41. private DateTime $createdAt;
  42. public function setCreatedAt(DateTime $createdAt): void
  43. {
  44. $this->createdAt = $createdAt;
  45. }
  46. public function getCreatedAt(): DateTime
  47. {
  48. return $this->createdAt;
  49. }
  50. #[ORM\ManyToOne(
  51. targetEntity: RecurrentJob::class,
  52. inversedBy: 'selfServiceTrafficCampaigns'
  53. )]
  54. #[ORM\JoinColumn(
  55. name: 'recurrent_jobs_id',
  56. referencedColumnName: 'id',
  57. nullable: true,
  58. onDelete: 'SET NULL'
  59. )]
  60. private ?RecurrentJob $recurrentJob;
  61. public function getRecurrentJobId(): ?RecurrentJob
  62. {
  63. return $this->recurrentJob;
  64. }
  65. public function setRecurrentJob(?RecurrentJob $recurrentJob): void
  66. {
  67. $this->recurrentJob = $recurrentJob;
  68. }
  69. #[ORM\OneToOne(
  70. targetEntity: SelfServiceTrafficCampaignBooking::class,
  71. inversedBy: 'campaign',
  72. cascade: ['persist']
  73. )]
  74. #[ORM\JoinColumn(
  75. name : 'self_service_traffic_campaign_booking_id',
  76. referencedColumnName: 'id',
  77. nullable : true,
  78. onDelete : 'CASCADE'
  79. )]
  80. private SelfServiceTrafficCampaignBooking $booking;
  81. public function getBooking(): SelfServiceTrafficCampaignBooking
  82. {
  83. return $this->booking;
  84. }
  85. public function setBooking(SelfServiceTrafficCampaignBooking $booking): void
  86. {
  87. $this->booking = $booking;
  88. }
  89. #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: false)]
  90. private DateTime $startDate;
  91. public function getStartDate(): DateTime
  92. {
  93. return $this->startDate;
  94. }
  95. public function setStartDate(DateTime $startDate): void
  96. {
  97. $this->startDate = $startDate;
  98. }
  99. #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: false)]
  100. private DateTime $endDate;
  101. public function getEndDate(): DateTime
  102. {
  103. return $this->endDate;
  104. }
  105. public function setEndDate(DateTime $endDate): void
  106. {
  107. $this->endDate = $endDate;
  108. }
  109. #[ORM\Column(
  110. type: Types::BOOLEAN,
  111. )]
  112. private bool $deleted = false;
  113. public function isDeleted(): bool
  114. {
  115. return $this->deleted;
  116. }
  117. public function setDeleted(bool $deleted): void
  118. {
  119. $this->deleted = $deleted;
  120. }
  121. }