1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Modules\Posts\Persistence\Doctrine\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use Symfony\Component\Uid\Ulid; |
7
|
|
|
|
8
|
|
|
#[ORM\Entity] |
9
|
|
|
#[ORM\Table(name: "POSTS")] |
10
|
|
|
class Post |
11
|
|
|
{ |
12
|
|
|
|
13
|
|
|
#[ORM\Id] |
14
|
|
|
#[ORM\Column(type: "ulid", unique: true)] |
15
|
|
|
private Ulid $id; |
16
|
|
|
|
17
|
|
|
#[ORM\Column(type: "string")] |
18
|
|
|
private string $title; |
19
|
|
|
|
20
|
|
|
#[ORM\Column(type: "string")] |
21
|
|
|
private string $summary; |
22
|
|
|
|
23
|
|
|
#[ORM\Column(type: "string")] |
24
|
|
|
private string $body; |
25
|
|
|
|
26
|
|
|
#[ORM\Column(type: "json")] |
27
|
|
|
private array $tags = []; |
28
|
|
|
|
29
|
|
|
#[ORM\Column(type: "ulid")] |
30
|
|
|
private Ulid $createdById; |
31
|
|
|
|
32
|
|
|
#[ORM\Column(type: "string")] |
33
|
|
|
private string $createdByName; |
34
|
|
|
|
35
|
|
|
#[ORM\Column(type: "datetime")] |
36
|
|
|
private \DateTime $createdAt; |
37
|
|
|
|
38
|
|
|
#[ORM\Column(type: "datetime")] |
39
|
|
|
private \DateTime $updatedAt; |
40
|
|
|
|
41
|
|
|
#[ORM\Column(type: "datetime", nullable: true)] |
42
|
|
|
private \DateTime $deletedAt; |
43
|
|
|
|
44
|
|
|
#[ORM\Version] |
45
|
|
|
#[ORM\Column(type: "integer")] |
46
|
|
|
private int $version; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @return Ulid |
50
|
|
|
*/ |
51
|
|
|
public function getId(): Ulid |
52
|
|
|
{ |
53
|
|
|
return $this->id; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @param Ulid $id |
58
|
|
|
*/ |
59
|
|
|
public function setId(Ulid $id): void |
60
|
|
|
{ |
61
|
|
|
$this->id = $id; |
62
|
|
|
} |
63
|
7 |
|
|
64
|
|
|
/** |
65
|
7 |
|
* @return string |
66
|
7 |
|
*/ |
67
|
|
|
public function getTitle(): string |
68
|
|
|
{ |
69
|
|
|
return $this->title; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @param string $title |
74
|
|
|
*/ |
75
|
|
|
public function setTitle(string $title): void |
76
|
|
|
{ |
77
|
|
|
$this->title = $title; |
78
|
|
|
} |
79
|
7 |
|
|
80
|
|
|
/** |
81
|
7 |
|
* @return string |
82
|
7 |
|
*/ |
83
|
|
|
public function getSummary(): string |
84
|
|
|
{ |
85
|
|
|
return $this->summary; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @param string $summary |
90
|
|
|
*/ |
91
|
|
|
public function setSummary(string $summary): void |
92
|
|
|
{ |
93
|
|
|
$this->summary = $summary; |
94
|
|
|
} |
95
|
7 |
|
|
96
|
|
|
/** |
97
|
7 |
|
* @return string |
98
|
7 |
|
*/ |
99
|
|
|
public function getBody(): string |
100
|
|
|
{ |
101
|
|
|
return $this->body; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @param string $body |
106
|
|
|
*/ |
107
|
|
|
public function setBody(string $body): void |
108
|
|
|
{ |
109
|
|
|
$this->body = $body; |
110
|
|
|
} |
111
|
7 |
|
|
112
|
|
|
/** |
113
|
7 |
|
* @return array |
114
|
7 |
|
*/ |
115
|
|
|
public function getTags(): array |
116
|
|
|
{ |
117
|
|
|
return $this->tags; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @param array $tags |
122
|
|
|
*/ |
123
|
|
|
public function setTags(array $tags): void |
124
|
|
|
{ |
125
|
|
|
$this->tags = $tags; |
126
|
|
|
} |
127
|
7 |
|
|
128
|
|
|
/** |
129
|
7 |
|
* @return Ulid |
130
|
7 |
|
*/ |
131
|
|
|
public function getCreatedById(): Ulid |
132
|
|
|
{ |
133
|
|
|
return $this->createdById; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @param Ulid $createdById |
138
|
|
|
*/ |
139
|
|
|
public function setCreatedById(Ulid $createdById): void |
140
|
|
|
{ |
141
|
|
|
$this->createdById = $createdById; |
142
|
|
|
} |
143
|
7 |
|
|
144
|
|
|
/** |
145
|
7 |
|
* @return string |
146
|
7 |
|
*/ |
147
|
|
|
public function getCreatedByName(): string |
148
|
|
|
{ |
149
|
|
|
return $this->createdByName; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @param string $createdByName |
154
|
|
|
*/ |
155
|
|
|
public function setCreatedByName(string $createdByName): void |
156
|
|
|
{ |
157
|
|
|
$this->createdByName = $createdByName; |
158
|
|
|
} |
159
|
7 |
|
|
160
|
|
|
/** |
161
|
7 |
|
* @return \DateTime |
162
|
7 |
|
*/ |
163
|
|
|
public function getCreatedAt(): \DateTime |
164
|
|
|
{ |
165
|
|
|
return $this->createdAt; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @param \DateTime $createdAt |
170
|
|
|
*/ |
171
|
|
|
public function setCreatedAt(\DateTime $createdAt): void |
172
|
|
|
{ |
173
|
|
|
$this->createdAt = $createdAt; |
174
|
|
|
} |
175
|
7 |
|
|
176
|
|
|
/** |
177
|
7 |
|
* @return \DateTime |
178
|
7 |
|
*/ |
179
|
|
|
public function getUpdatedAt(): \DateTime |
180
|
|
|
{ |
181
|
|
|
return $this->updatedAt; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* @param \DateTime $updatedAt |
186
|
|
|
*/ |
187
|
|
|
public function setUpdatedAt(\DateTime $updatedAt): void |
188
|
|
|
{ |
189
|
|
|
$this->updatedAt = $updatedAt; |
190
|
|
|
} |
191
|
7 |
|
|
192
|
|
|
/** |
193
|
7 |
|
* @return mixed |
194
|
7 |
|
*/ |
195
|
|
|
public function getVersion() |
196
|
|
|
{ |
197
|
|
|
return $this->version; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* @param mixed $version |
202
|
|
|
*/ |
203
|
|
|
public function setVersion($version): void |
204
|
|
|
{ |
205
|
|
|
$this->version = $version; |
206
|
|
|
} |
207
|
7 |
|
|
208
|
|
|
/** |
209
|
7 |
|
* @return \DateTime |
210
|
7 |
|
*/ |
211
|
|
|
public function getDeletedAt(): \DateTime |
212
|
|
|
{ |
213
|
|
|
return $this->deletedAt; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
|
217
|
|
|
|
218
|
|
|
|
219
|
|
|
|
220
|
|
|
} |