1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Modules\Security\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: "POST_HEADERS")] |
10
|
|
|
class UserPostHeader |
11
|
|
|
{ |
12
|
|
|
#[ORM\Id] |
13
|
|
|
#[ORM\Column(type: "ulid", unique: true)] |
14
|
|
|
private Ulid $id; |
15
|
|
|
|
16
|
|
|
#[ORM\Column(type: "string")] |
17
|
|
|
private string $title; |
18
|
|
|
|
19
|
|
|
#[ORM\Column(type: "string")] |
20
|
|
|
private string $summary; |
21
|
|
|
|
22
|
|
|
#[ORM\Column(type: "integer")] |
23
|
|
|
private int $commentsCount; |
24
|
|
|
|
25
|
|
|
#[ORM\Column(type: "json")] |
26
|
|
|
private array $tags = []; |
27
|
|
|
|
28
|
|
|
#[ORM\Column(type: "datetime")] |
29
|
|
|
private \DateTime $createdAt; |
30
|
|
|
|
31
|
|
|
#[ORM\Column(type: "integer")] |
32
|
|
|
private int $version; |
33
|
|
|
|
34
|
|
|
#[ORM\ManyToOne(targetEntity: User::class)] |
35
|
|
|
#[ORM\JoinColumn(name: "userId", referencedColumnName: "id")] |
36
|
|
|
private User $user; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @return Ulid |
40
|
|
|
*/ |
41
|
|
|
public function getId(): Ulid |
42
|
|
|
{ |
43
|
|
|
return $this->id; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @param Ulid $id |
48
|
|
|
*/ |
49
|
|
|
public function setId(Ulid $id): void |
50
|
1 |
|
{ |
51
|
|
|
$this->id = $id; |
52
|
1 |
|
} |
53
|
1 |
|
|
54
|
|
|
/** |
55
|
|
|
* @return string |
56
|
|
|
*/ |
57
|
|
|
public function getTitle(): string |
58
|
|
|
{ |
59
|
|
|
return $this->title; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @param string $title |
64
|
|
|
*/ |
65
|
|
|
public function setTitle(string $title): void |
66
|
1 |
|
{ |
67
|
|
|
$this->title = $title; |
68
|
1 |
|
} |
69
|
1 |
|
|
70
|
|
|
/** |
71
|
|
|
* @return string |
72
|
|
|
*/ |
73
|
|
|
public function getSummary(): string |
74
|
|
|
{ |
75
|
|
|
return $this->summary; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param string $summary |
80
|
|
|
*/ |
81
|
|
|
public function setSummary(string $summary): void |
82
|
1 |
|
{ |
83
|
|
|
$this->summary = $summary; |
84
|
1 |
|
} |
85
|
1 |
|
|
86
|
|
|
/** |
87
|
|
|
* @return int |
88
|
|
|
*/ |
89
|
|
|
public function getCommentsCount(): int |
90
|
|
|
{ |
91
|
|
|
return $this->commentsCount; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @param int $commentsCount |
96
|
|
|
*/ |
97
|
|
|
public function setCommentsCount(int $commentsCount): void |
98
|
1 |
|
{ |
99
|
|
|
$this->commentsCount = $commentsCount; |
100
|
1 |
|
} |
101
|
1 |
|
|
102
|
|
|
/** |
103
|
|
|
* @return array |
104
|
|
|
*/ |
105
|
|
|
public function getTags(): array |
106
|
|
|
{ |
107
|
|
|
return $this->tags; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @param array $tags |
112
|
|
|
*/ |
113
|
|
|
public function setTags(array $tags): void |
114
|
1 |
|
{ |
115
|
|
|
$this->tags = $tags; |
116
|
1 |
|
} |
117
|
1 |
|
|
118
|
|
|
/** |
119
|
|
|
* @return \DateTime |
120
|
|
|
*/ |
121
|
|
|
public function getCreatedAt(): \DateTime |
122
|
|
|
{ |
123
|
|
|
return $this->createdAt; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @param \DateTime $createdAt |
128
|
|
|
*/ |
129
|
|
|
public function setCreatedAt(\DateTime $createdAt): void |
130
|
1 |
|
{ |
131
|
|
|
$this->createdAt = $createdAt; |
132
|
1 |
|
} |
133
|
1 |
|
|
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @return mixed |
137
|
|
|
*/ |
138
|
|
|
public function getVersion() |
139
|
|
|
{ |
140
|
|
|
return $this->version; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @param mixed $version |
145
|
|
|
*/ |
146
|
|
|
public function setVersion($version): void |
147
|
1 |
|
{ |
148
|
|
|
$this->version = $version; |
149
|
1 |
|
} |
150
|
1 |
|
|
151
|
|
|
/** |
152
|
|
|
* @return User |
153
|
|
|
*/ |
154
|
|
|
public function getUser(): User |
155
|
|
|
{ |
156
|
|
|
return $this->user; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @param User $user |
161
|
|
|
*/ |
162
|
|
|
public function setUser(User $user): void |
163
|
1 |
|
{ |
164
|
|
|
$this->user = $user; |
165
|
1 |
|
} |
166
|
1 |
|
|
167
|
|
|
|
168
|
|
|
|
169
|
|
|
|
170
|
|
|
} |