<?php
declare(strict_types=1);
namespace JanusHercules\IndeedCampaignManagement\Domain\Entity;
use App\Utility\DatabaseIdGenerator;
use App\Utility\DateTimeUtility;
use DateTime;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Exception;
use JanusHercules\IndeedCampaignManagement\Domain\Enum\SyncRunStatus;
#[ORM\Entity]
#[ORM\Table(name: 'icm_sync_runs')]
class SyncRun
{
/**
* @throws Exception
*/
public function __construct()
{
$this->createdAt = DateTimeUtility::createDateTimeUtc();
$this->status = SyncRunStatus::STARTED;
}
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: DatabaseIdGenerator::class)]
#[ORM\Column(type: Types::GUID, unique: true)]
private ?string $id = null;
public function getId(): ?string
{
return $this->id;
}
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: false)]
private DateTime $createdAt;
public function getCreatedAt(): DateTime
{
return $this->createdAt;
}
#[ORM\Column(type: Types::STRING, enumType: SyncRunStatus::class)]
private SyncRunStatus $status;
public function getStatus(): SyncRunStatus
{
return $this->status;
}
public function setStatus(SyncRunStatus $status): void
{
$this->status = $status;
}
#[ORM\Column(name: 'error_message', type: Types::TEXT, nullable: true)]
private ?string $errorMessage = null;
public function getErrorMessage(): ?string
{
return $this->errorMessage;
}
public function setErrorMessage(?string $errorMessage): void
{
$this->errorMessage = $errorMessage;
}
}