|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Locastic\Loggastic\Model\Output; |
|
4
|
|
|
|
|
5
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Save the latest data for each object, so it can be used to compare changes |
|
9
|
|
|
* when logging updates to activity log. |
|
10
|
|
|
*/ |
|
11
|
|
|
class CurrentDataTracker implements CurrentDataTrackerInterface |
|
12
|
|
|
{ |
|
13
|
|
|
protected $id; |
|
14
|
|
|
|
|
15
|
|
|
#[Groups(["current_data_tracker"])] |
|
16
|
|
|
protected $objectId; |
|
17
|
|
|
|
|
18
|
|
|
#[Groups(["current_data_tracker"])] |
|
19
|
|
|
protected \DateTime $dateTime; |
|
20
|
|
|
|
|
21
|
|
|
#[Groups(["current_data_tracker"])] |
|
22
|
|
|
protected ?string $objectClass = null; |
|
23
|
|
|
|
|
24
|
|
|
#[Groups(["current_data_tracker"])] |
|
25
|
|
|
protected array $data = []; |
|
26
|
|
|
|
|
27
|
|
|
public function __construct() |
|
28
|
|
|
{ |
|
29
|
|
|
$this->dateTime = new \DateTime(); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function getId() |
|
33
|
|
|
{ |
|
34
|
|
|
return $this->id; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
public function setId($id): void |
|
38
|
|
|
{ |
|
39
|
|
|
$this->id = $id; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function getObjectId(): string |
|
43
|
|
|
{ |
|
44
|
|
|
return (string) $this->objectId; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public function setObjectId(string $objectId): void |
|
48
|
|
|
{ |
|
49
|
|
|
$this->objectId = $objectId; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function getObjectClass(): ?string |
|
53
|
|
|
{ |
|
54
|
|
|
return $this->objectClass; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function setObjectClass(?string $objectClass): void |
|
58
|
|
|
{ |
|
59
|
|
|
$this->objectClass = $objectClass; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function getData(): array |
|
63
|
|
|
{ |
|
64
|
|
|
return $this->data; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
public function setData(string $data): void |
|
68
|
|
|
{ |
|
69
|
|
|
$this->data = json_decode($data, true, 512, JSON_THROW_ON_ERROR); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
public function getDateTime(): \DateTime |
|
73
|
|
|
{ |
|
74
|
|
|
return $this->dateTime; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function setDateTime(\DateTime $dateTime): void |
|
78
|
|
|
{ |
|
79
|
|
|
$this->dateTime = $dateTime; |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|