src/Entity/Sync/SyncableResourceAppState.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Sync;
  3. use App\Entity\App\App;
  4. use App\Repository\Sync\SyncableResourceAppStateRepository;
  5. use Doctrine\ORM\Mapping\JoinColumn;
  6. use DrosalysWeb\ObjectExtensions\Timestamp\Model\TimestampInterface;
  7. use DrosalysWeb\ObjectExtensions\Timestamp\Model\TimestampTrait;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[
  10. ORM\Entity(repositoryClass: SyncableResourceAppStateRepository::class),
  11. ORM\UniqueConstraint(fields: ['syncableResource', 'app']),
  12. ORM\Index(fields: ['app']),
  13. ORM\Index(fields: ['status']),
  14. ORM\Table(name: 'syncable_resource_app_state')
  15. ]
  16. class SyncableResourceAppState implements TimestampInterface
  17. {
  18. use TimestampTrait;
  19. #[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
  20. private ?int $id = null;
  21. #[ORM\ManyToOne(targetEntity: SyncableResource::class, fetch: 'EAGER', inversedBy: 'syncableResourceAppStates')]
  22. #[JoinColumn(nullable: false, onDelete: 'cascade')]
  23. private ?SyncableResource $syncableResource = null;
  24. #[ORM\ManyToOne(targetEntity: App::class)]
  25. #[JoinColumn(nullable: false, onDelete: 'cascade')]
  26. private ?App $app = null;
  27. #[ORM\Column(type: 'string', length: 255, nullable: false)]
  28. private ?string $status = null;
  29. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  30. private ?string $lastSyncRequestUuid = null;
  31. #[ORM\Column(type: 'datetime', nullable: true)]
  32. private ?\DateTime $lastAckedAt = null;
  33. #[ORM\Column(type: 'datetime', nullable: true)]
  34. private ?\DateTime $lastAttemptAt = null;
  35. #[ORM\Column(type: 'text', nullable: true)]
  36. private ?string $lastErrorMessage = null;
  37. public function getId(): ?int
  38. {
  39. return $this->id;
  40. }
  41. public function getApp(): ?App
  42. {
  43. return $this->app;
  44. }
  45. public function setApp(?App $app): SyncableResourceAppState
  46. {
  47. $this->app = $app;
  48. return $this;
  49. }
  50. public function getSyncableResource(): ?SyncableResource
  51. {
  52. return $this->syncableResource;
  53. }
  54. public function setSyncableResource(?SyncableResource $syncableResource): SyncableResourceAppState
  55. {
  56. $this->syncableResource = $syncableResource;
  57. return $this;
  58. }
  59. public function getStatus(): ?string
  60. {
  61. return $this->status;
  62. }
  63. public function setStatus(?string $status): SyncableResourceAppState
  64. {
  65. $this->status = $status;
  66. return $this;
  67. }
  68. public function getLastAckedAt(): ?\DateTime
  69. {
  70. return $this->lastAckedAt;
  71. }
  72. public function setLastAckedAt(?\DateTime $lastAckedAt): SyncableResourceAppState
  73. {
  74. $this->lastAckedAt = $lastAckedAt;
  75. return $this;
  76. }
  77. public function getLastAttemptAt(): ?\DateTime
  78. {
  79. return $this->lastAttemptAt;
  80. }
  81. public function setLastAttemptAt(?\DateTime $lastAttemptAt): SyncableResourceAppState
  82. {
  83. $this->lastAttemptAt = $lastAttemptAt;
  84. return $this;
  85. }
  86. public function getLastErrorMessage(): ?string
  87. {
  88. return $this->lastErrorMessage;
  89. }
  90. public function setLastErrorMessage(?string $lastErrorMessage): SyncableResourceAppState
  91. {
  92. $this->lastErrorMessage = $lastErrorMessage;
  93. return $this;
  94. }
  95. public function getLastSyncRequestUuid(): ?string
  96. {
  97. return $this->lastSyncRequestUuid;
  98. }
  99. public function setLastSyncRequestUuid(?string $lastSyncRequestUuid): SyncableResourceAppState
  100. {
  101. $this->lastSyncRequestUuid = $lastSyncRequestUuid;
  102. return $this;
  103. }
  104. }