<?php
namespace App\Entity\Sync;
use App\Entity\App\App;
use App\Repository\Sync\SyncableResourceAppStateRepository;
use Doctrine\ORM\Mapping\JoinColumn;
use DrosalysWeb\ObjectExtensions\Timestamp\Model\TimestampInterface;
use DrosalysWeb\ObjectExtensions\Timestamp\Model\TimestampTrait;
use Doctrine\ORM\Mapping as ORM;
#[
ORM\Entity(repositoryClass: SyncableResourceAppStateRepository::class),
ORM\UniqueConstraint(fields: ['syncableResource', 'app']),
ORM\Index(fields: ['app']),
ORM\Index(fields: ['status']),
ORM\Table(name: 'syncable_resource_app_state')
]
class SyncableResourceAppState implements TimestampInterface
{
use TimestampTrait;
#[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
private ?int $id = null;
#[ORM\ManyToOne(targetEntity: SyncableResource::class, fetch: 'EAGER', inversedBy: 'syncableResourceAppStates')]
#[JoinColumn(nullable: false, onDelete: 'cascade')]
private ?SyncableResource $syncableResource = null;
#[ORM\ManyToOne(targetEntity: App::class)]
#[JoinColumn(nullable: false, onDelete: 'cascade')]
private ?App $app = null;
#[ORM\Column(type: 'string', length: 255, nullable: false)]
private ?string $status = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $lastSyncRequestUuid = null;
#[ORM\Column(type: 'datetime', nullable: true)]
private ?\DateTime $lastAckedAt = null;
#[ORM\Column(type: 'datetime', nullable: true)]
private ?\DateTime $lastAttemptAt = null;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $lastErrorMessage = null;
public function getId(): ?int
{
return $this->id;
}
public function getApp(): ?App
{
return $this->app;
}
public function setApp(?App $app): SyncableResourceAppState
{
$this->app = $app;
return $this;
}
public function getSyncableResource(): ?SyncableResource
{
return $this->syncableResource;
}
public function setSyncableResource(?SyncableResource $syncableResource): SyncableResourceAppState
{
$this->syncableResource = $syncableResource;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): SyncableResourceAppState
{
$this->status = $status;
return $this;
}
public function getLastAckedAt(): ?\DateTime
{
return $this->lastAckedAt;
}
public function setLastAckedAt(?\DateTime $lastAckedAt): SyncableResourceAppState
{
$this->lastAckedAt = $lastAckedAt;
return $this;
}
public function getLastAttemptAt(): ?\DateTime
{
return $this->lastAttemptAt;
}
public function setLastAttemptAt(?\DateTime $lastAttemptAt): SyncableResourceAppState
{
$this->lastAttemptAt = $lastAttemptAt;
return $this;
}
public function getLastErrorMessage(): ?string
{
return $this->lastErrorMessage;
}
public function setLastErrorMessage(?string $lastErrorMessage): SyncableResourceAppState
{
$this->lastErrorMessage = $lastErrorMessage;
return $this;
}
public function getLastSyncRequestUuid(): ?string
{
return $this->lastSyncRequestUuid;
}
public function setLastSyncRequestUuid(?string $lastSyncRequestUuid): SyncableResourceAppState
{
$this->lastSyncRequestUuid = $lastSyncRequestUuid;
return $this;
}
}