|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Orm\Entity; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
8
|
|
|
use Doctrine\Common\Collections\Collection; |
|
9
|
|
|
use Doctrine\ORM\Mapping\Column; |
|
10
|
|
|
use Doctrine\ORM\Mapping\Entity; |
|
11
|
|
|
use Doctrine\ORM\Mapping\GeneratedValue; |
|
12
|
|
|
use Doctrine\ORM\Mapping\Id; |
|
13
|
|
|
use Doctrine\ORM\Mapping\Index; |
|
14
|
|
|
use Doctrine\ORM\Mapping\OneToMany; |
|
15
|
|
|
use Doctrine\ORM\Mapping\Table; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @Entity(repositoryClass="Stu\Orm\Repository\RpgPlotArchivRepository") |
|
19
|
|
|
* @Table( |
|
20
|
|
|
* name="stu_plots_archiv", |
|
21
|
|
|
* indexes={ |
|
22
|
|
|
* @Index(name="rpg_plot_archiv_end_date_idx", columns={"end_date"}), |
|
23
|
|
|
* } |
|
24
|
|
|
* ) |
|
25
|
|
|
**/ |
|
26
|
|
|
class RpgPlotArchiv implements RpgPlotArchivInterface |
|
27
|
|
|
{ |
|
28
|
|
|
/** |
|
29
|
|
|
* @Id |
|
30
|
|
|
* @Column(type="integer") |
|
31
|
|
|
* @GeneratedValue(strategy="IDENTITY") |
|
32
|
|
|
* |
|
33
|
|
|
*/ |
|
34
|
|
|
private int $id; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @Column(type="string", nullable=true) |
|
38
|
|
|
* |
|
39
|
|
|
*/ |
|
40
|
|
|
private ?string $version = ''; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @Column(type="integer", nullable=true) |
|
44
|
|
|
* |
|
45
|
|
|
*/ |
|
46
|
|
|
private ?int $former_id = 0; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @Column(type="integer", nullable=true) |
|
50
|
|
|
* |
|
51
|
|
|
*/ |
|
52
|
|
|
private ?int $user_id = 0; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @Column(type="string", nullable=true) |
|
56
|
|
|
* |
|
57
|
|
|
*/ |
|
58
|
|
|
private ?string $title = ''; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @Column(type="text", nullable=true) |
|
62
|
|
|
* |
|
63
|
|
|
*/ |
|
64
|
|
|
private ?string $description = ''; |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @Column(type="integer", nullable=true) |
|
68
|
|
|
* |
|
69
|
|
|
*/ |
|
70
|
|
|
private ?int $start_date = 0; |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @Column(type="integer", nullable=true) |
|
74
|
|
|
* |
|
75
|
|
|
*/ |
|
76
|
|
|
private ?int $end_date = null; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @var ArrayCollection<int, KnPostArchivInterface> |
|
80
|
|
|
* |
|
81
|
|
|
* @OneToMany(targetEntity="KnPostArchiv", mappedBy="rpgPlot") |
|
82
|
|
|
*/ |
|
83
|
|
|
private Collection $posts; |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* @var ArrayCollection<int, RpgPlotMemberArchivInterface> |
|
87
|
|
|
* |
|
88
|
|
|
* @OneToMany(targetEntity="RpgPlotMemberArchiv", mappedBy="rpgPlot", indexBy="user_id") |
|
89
|
|
|
*/ |
|
90
|
|
|
private Collection $members; |
|
91
|
|
|
|
|
92
|
|
|
public function __construct() |
|
93
|
|
|
{ |
|
94
|
|
|
$this->posts = new ArrayCollection(); |
|
95
|
|
|
$this->members = new ArrayCollection(); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
public function getId(): int |
|
99
|
|
|
{ |
|
100
|
|
|
return $this->id; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
public function getVersion(): ?string |
|
104
|
|
|
{ |
|
105
|
|
|
return $this->version; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
public function getFormerId(): int |
|
109
|
|
|
{ |
|
110
|
|
|
return $this->former_id; |
|
|
|
|
|
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
public function getUserId(): int |
|
114
|
|
|
{ |
|
115
|
|
|
return $this->user_id; |
|
|
|
|
|
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
public function getTitle(): string |
|
119
|
|
|
{ |
|
120
|
|
|
return $this->title; |
|
|
|
|
|
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
public function setTitle(string $title): RpgPlotArchivInterface |
|
124
|
|
|
{ |
|
125
|
|
|
$this->title = $title; |
|
126
|
|
|
|
|
127
|
|
|
return $this; |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
public function getDescription(): string |
|
131
|
|
|
{ |
|
132
|
|
|
return $this->description; |
|
|
|
|
|
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
public function setDescription(string $description): RpgPlotArchivInterface |
|
136
|
|
|
{ |
|
137
|
|
|
$this->description = $description; |
|
138
|
|
|
|
|
139
|
|
|
return $this; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
public function getStartDate(): int |
|
143
|
|
|
{ |
|
144
|
|
|
return $this->start_date; |
|
|
|
|
|
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
public function setStartDate(int $startDate): RpgPlotArchivInterface |
|
148
|
|
|
{ |
|
149
|
|
|
$this->start_date = $startDate; |
|
150
|
|
|
|
|
151
|
|
|
return $this; |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
public function getEndDate(): ?int |
|
155
|
|
|
{ |
|
156
|
|
|
return $this->end_date; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
public function setEndDate(?int $endDate): RpgPlotArchivInterface |
|
160
|
|
|
{ |
|
161
|
|
|
$this->end_date = $endDate; |
|
162
|
|
|
|
|
163
|
|
|
return $this; |
|
164
|
|
|
} |
|
165
|
|
|
|
|
166
|
|
|
public function isActive(): bool |
|
167
|
|
|
{ |
|
168
|
|
|
return $this->getEndDate() === null || $this->getEndDate() === 0; |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
public function getPosts(): Collection |
|
172
|
|
|
{ |
|
173
|
|
|
return $this->posts; |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
public function getMemberCount(): int |
|
177
|
|
|
{ |
|
178
|
|
|
return $this->members->count(); |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
public function getPostingCount(): int |
|
182
|
|
|
{ |
|
183
|
|
|
return $this->posts->count(); |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
public function getMembers(): Collection |
|
187
|
|
|
{ |
|
188
|
|
|
return $this->members; |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
public function __toString(): string |
|
192
|
|
|
{ |
|
193
|
|
|
return sprintf('title: %s', $this->getTitle()); |
|
194
|
|
|
} |
|
195
|
|
|
} |
|
196
|
|
|
|