1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Dsantang\DomainEventsDoctrine\OutboxEvents; |
6
|
|
|
|
7
|
|
|
use DateTimeImmutable; |
8
|
|
|
use Doctrine\ORM\Mapping as ORM; |
9
|
|
|
use Doctrine\ORM\Mapping\MappedSuperclass; |
10
|
|
|
use Ramsey\Uuid\UuidInterface; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @MappedSuperclass |
14
|
|
|
*/ |
15
|
|
|
abstract class OutboxMappedSuperclass |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @ORM\Id() |
19
|
|
|
* @ORM\Column(type="uuid", name="id") |
20
|
|
|
* |
21
|
|
|
* @var UuidInterface |
22
|
|
|
*/ |
23
|
|
|
protected $id; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @ORM\Column(type="string", name="message_key", nullable=false) |
27
|
|
|
* |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
protected $messageKey; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @ORM\Column(type="string", name="message_route", nullable=false) |
34
|
|
|
* |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
protected $messageRoute; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @ORM\Column(type="string", name="message_type", nullable=false) |
41
|
|
|
* |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
protected $messageType; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @ORM\Column(type="uuid", name="aggregate_id", nullable=false) |
48
|
|
|
* |
49
|
|
|
* @var UuidInterface |
50
|
|
|
*/ |
51
|
|
|
protected $aggregateId; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @ORM\Column(type="string", name="aggregate_type", nullable=false) |
55
|
|
|
* |
56
|
|
|
* @var string |
57
|
|
|
*/ |
58
|
|
|
protected $aggregateType; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @ORM\Column(type="string", name="payload_type", nullable=false) |
62
|
|
|
* |
63
|
|
|
* @var string |
64
|
|
|
*/ |
65
|
|
|
protected $payloadType; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @ORM\Column(type="json", name="payload", nullable=false) |
69
|
|
|
* |
70
|
|
|
* @var string |
71
|
|
|
*/ |
72
|
|
|
protected $payload; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @ORM\Column(type="integer", name="schema_version", nullable=false) |
76
|
|
|
* |
77
|
|
|
* @var int |
78
|
|
|
*/ |
79
|
|
|
protected $schemaVersion; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @ORM\Column(type="utc_datetime_immutable", name="created_at", nullable=false) |
83
|
|
|
* |
84
|
|
|
* @var DateTimeImmutable |
85
|
|
|
*/ |
86
|
|
|
protected $createdAt; |
87
|
|
|
|
88
|
2 |
|
public function setId(UuidInterface $id) : self |
89
|
|
|
{ |
90
|
2 |
|
$this->id = $id; |
91
|
|
|
|
92
|
2 |
|
return $this; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
public function setMessageKey(string $messageKey) : self |
96
|
|
|
{ |
97
|
|
|
$this->messageKey = $messageKey; |
98
|
|
|
|
99
|
|
|
return $this; |
100
|
|
|
} |
101
|
|
|
|
102
|
2 |
|
public function setMessageRoute(string $messageRoute) : self |
103
|
|
|
{ |
104
|
2 |
|
$this->messageRoute = $messageRoute; |
105
|
|
|
|
106
|
2 |
|
return $this; |
107
|
|
|
} |
108
|
|
|
|
109
|
2 |
|
public function setMessageType(string $messageType) : self |
110
|
|
|
{ |
111
|
2 |
|
$this->messageType = $messageType; |
112
|
|
|
|
113
|
2 |
|
return $this; |
114
|
|
|
} |
115
|
|
|
|
116
|
2 |
|
public function setAggregateId(UuidInterface $aggregateId) : self |
117
|
|
|
{ |
118
|
2 |
|
$this->aggregateId = $aggregateId; |
119
|
|
|
|
120
|
2 |
|
return $this; |
121
|
|
|
} |
122
|
|
|
|
123
|
2 |
|
public function setAggregateType(string $aggregateType) : self |
124
|
|
|
{ |
125
|
2 |
|
$this->aggregateType = $aggregateType; |
126
|
|
|
|
127
|
2 |
|
return $this; |
128
|
|
|
} |
129
|
|
|
|
130
|
2 |
|
public function setPayloadType(string $payloadType) : self |
131
|
|
|
{ |
132
|
2 |
|
$this->payloadType = $payloadType; |
133
|
|
|
|
134
|
2 |
|
return $this; |
135
|
|
|
} |
136
|
|
|
|
137
|
2 |
|
public function setPayload(string $payload) : self |
138
|
|
|
{ |
139
|
2 |
|
$this->payload = $payload; |
140
|
|
|
|
141
|
2 |
|
return $this; |
142
|
|
|
} |
143
|
|
|
|
144
|
2 |
|
public function setSchemaVersion(int $schemaVersion) : self |
145
|
|
|
{ |
146
|
2 |
|
$this->schemaVersion = $schemaVersion; |
147
|
|
|
|
148
|
2 |
|
return $this; |
149
|
|
|
} |
150
|
|
|
|
151
|
2 |
|
public function setCreatedAt(DateTimeImmutable $createdAt) : self |
152
|
|
|
{ |
153
|
2 |
|
$this->createdAt = $createdAt; |
154
|
|
|
|
155
|
2 |
|
return $this; |
156
|
|
|
} |
157
|
|
|
} |
158
|
|
|
|