src/JanusHercules/IndeedCampaignManagement/Domain/Entity/SyncRun.php line 17

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\SyncRunStatus;
  11. #[ORM\Entity]
  12. #[ORM\Table(name: 'icm_sync_runs')]
  13. class SyncRun
  14. {
  15. /**
  16. * @throws Exception
  17. */
  18. public function __construct()
  19. {
  20. $this->createdAt = DateTimeUtility::createDateTimeUtc();
  21. $this->status = SyncRunStatus::STARTED;
  22. }
  23. #[ORM\Id]
  24. #[ORM\GeneratedValue(strategy: 'CUSTOM')]
  25. #[ORM\CustomIdGenerator(class: DatabaseIdGenerator::class)]
  26. #[ORM\Column(type: Types::GUID, unique: true)]
  27. private ?string $id = null;
  28. public function getId(): ?string
  29. {
  30. return $this->id;
  31. }
  32. #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: false)]
  33. private DateTime $createdAt;
  34. public function getCreatedAt(): DateTime
  35. {
  36. return $this->createdAt;
  37. }
  38. #[ORM\Column(type: Types::STRING, enumType: SyncRunStatus::class)]
  39. private SyncRunStatus $status;
  40. public function getStatus(): SyncRunStatus
  41. {
  42. return $this->status;
  43. }
  44. public function setStatus(SyncRunStatus $status): void
  45. {
  46. $this->status = $status;
  47. }
  48. #[ORM\Column(name: 'error_message', type: Types::TEXT, nullable: true)]
  49. private ?string $errorMessage = null;
  50. public function getErrorMessage(): ?string
  51. {
  52. return $this->errorMessage;
  53. }
  54. public function setErrorMessage(?string $errorMessage): void
  55. {
  56. $this->errorMessage = $errorMessage;
  57. }
  58. }