src/JanusHercules/IndeedCampaignManagement/Domain/Entity/SyncRunEvent.php line 18

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace JanusHercules\IndeedCampaignManagement\Domain\Entity;
  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. use JanusHercules\IndeedCampaignManagement\Domain\Enum\CampaignType;
  11. use JanusHercules\IndeedCampaignManagement\Domain\Enum\RecurrentJobsSource;
  12. #[ORM\Entity]
  13. #[ORM\Table(name: 'icm_sync_run_events')]
  14. class SyncRunEvent
  15. {
  16. /**
  17. * @throws Exception
  18. */
  19. public function __construct(
  20. #[ORM\ManyToOne(targetEntity: SyncRun::class)]
  21. #[ORM\JoinColumn(name: 'icm_sync_runs_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
  22. private readonly SyncRun $syncRun,
  23. #[ORM\Column(type: Types::TEXT, nullable: false)]
  24. private readonly string $message,
  25. #[ORM\Column(type: Types::GUID, nullable: true)]
  26. private readonly ?string $recurrentJobId = null,
  27. #[ORM\Column(type: Types::STRING, nullable: true, enumType: RecurrentJobsSource::class)]
  28. private readonly ?RecurrentJobsSource $recurrentJobsSource = null,
  29. #[ORM\Column(type: Types::STRING, nullable: true, enumType: CampaignType::class)]
  30. private readonly ?CampaignType $campaignType = null,
  31. #[ORM\Column(name: 'customer_internal_id', type: Types::STRING, nullable: true)]
  32. private readonly ?string $customerInternalId = null,
  33. ) {
  34. $this->createdAt = DateTimeUtility::createDateTimeUtc();
  35. }
  36. #[ORM\Id]
  37. #[ORM\GeneratedValue(strategy: 'CUSTOM')]
  38. #[ORM\CustomIdGenerator(class: DatabaseIdGenerator::class)]
  39. #[ORM\Column(type: Types::GUID, unique: true)]
  40. private ?string $id = null;
  41. public function getId(): ?string
  42. {
  43. return $this->id;
  44. }
  45. public function getSyncRun(): SyncRun
  46. {
  47. return $this->syncRun;
  48. }
  49. #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: false)]
  50. private DateTime $createdAt;
  51. public function getCreatedAt(): DateTime
  52. {
  53. return $this->createdAt;
  54. }
  55. public function getMessage(): string
  56. {
  57. return $this->message;
  58. }
  59. public function getRecurrentJobId(): ?string
  60. {
  61. return $this->recurrentJobId;
  62. }
  63. public function getRecurrentJobsSource(): ?RecurrentJobsSource
  64. {
  65. return $this->recurrentJobsSource;
  66. }
  67. public function getCampaignType(): ?CampaignType
  68. {
  69. return $this->campaignType;
  70. }
  71. public function getCustomerInternalId(): ?string
  72. {
  73. return $this->customerInternalId;
  74. }
  75. }