Passed
Push — dev ( 85b774...2f21a8 )
by Nico
69:23
created

KnPostArchiv::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
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\JoinColumn;
15
use Doctrine\ORM\Mapping\ManyToOne;
16
use Doctrine\ORM\Mapping\OneToMany;
17
use Doctrine\ORM\Mapping\OrderBy;
18
use Doctrine\ORM\Mapping\Table;
19
use Stu\Module\Communication\View\ShowSingleKn\ShowSingleKn;
20
21
/**
22
 * @Entity(repositoryClass="Stu\Orm\Repository\KnPostArchivRepository")
23
 * @Table(
24
 *     name="stu_kn_archiv",
25
 *     indexes={
26
 *         @Index(name="plot_archiv_idx", columns={"plot_id"}),
27
 *         @Index(name="kn_post_archiv_date_idx", columns={"date"}),
28
 *     }
29
 * )
30
 **/
31
class KnPostArchiv implements KnPostArchivInterface
32
{
33
    /**
34
     * @Id
35
     * @Column(type="integer")
36
     * @GeneratedValue(strategy="IDENTITY")
37
     *
38
     */
39
    private int $id;
40
41
    /**
42
     * @Column(type="string", nullable=true)
43
     *
44
     */
45
    private ?string $version = '';
46
47
    /**
48
     * @Id
49
     * @Column(type="integer")
50
     *
51
     */
52
    private int $former_id;
53
54
    /**
55
     * @Column(type="string", nullable=true)
56
     *
57
     */
58
    private ?string $titel = '';
59
60
    /**
61
     * @Column(type="text")
62
     *
63
     */
64
    private string $text = '';
65
66
    /**
67
     * @Column(type="integer")
68
     *
69
     */
70
    private int $date = 0;
71
72
    /**
73
     * @Column(type="string")
74
     *
75
     */
76
    private string $username = '';
77
78
    /**
79
     * @Column(type="integer", nullable=true)
80
     *
81
     */
82
    private ?int $user_id = 0;
83
84
    /**
85
     * @Column(type="integer", nullable=true)
86
     *
87
     */
88
    private ?int $del_user_id = 0;
89
90
    /**
91
     * @Column(type="integer")
92
     *
93
     */
94
    private int $lastedit = 0;
95
96
    /**
97
     * @Column(type="integer", nullable=true)
98
     *
99
     */
100
    private ?int $plot_id = null;
101
102
    /**
103
     * @Column(type="json")
104
     *
105
     * @var array<mixed>
106
     */
107
    private array $ratings = [];
108
109
    /**
110
     * @var ArrayCollection<int, KnCommentArchivInterface>
111
     *
112
     * @OneToMany(targetEntity="KnCommentArchiv", mappedBy="post")
113
     * @OrderBy({"id": "ASC"})
114
     */
115
    private Collection $comments;
116
117
    /**
118
     *
119
     * @ManyToOne(targetEntity="RpgPlotArchiv", inversedBy="posts")
120
     * @JoinColumn(name="plot_id", referencedColumnName="id")
121
     */
122
    private ?RpgPlotArchivInterface $rpgPlot = null;
123
124
    public function __construct()
125
    {
126
        $this->comments = new ArrayCollection();
127
    }
128
129
    public function getId(): int
130
    {
131
        return $this->id;
132
    }
133
134
    public function getVersion(): ?string
135
    {
136
        return $this->version;
137
    }
138
139
    public function getFormerId(): int
140
    {
141
        return $this->former_id;
142
    }
143
144
    public function getTitle(): ?string
145
    {
146
        return $this->titel;
147
    }
148
149
    public function setTitle(string $title): KnPostArchivInterface
150
    {
151
        $this->titel = $title;
152
153
        return $this;
154
    }
155
156
    public function getText(): string
157
    {
158
        return $this->text;
159
    }
160
161
    public function setText(string $text): KnPostArchivInterface
162
    {
163
        $this->text = $text;
164
165
        return $this;
166
    }
167
168
    public function getDate(): int
169
    {
170
        return $this->date;
171
    }
172
173
    public function setDate(int $date): KnPostArchivInterface
174
    {
175
        $this->date = $date;
176
177
        return $this;
178
    }
179
180
    public function getUsername(): string
181
    {
182
        return $this->username;
183
    }
184
185
    public function setUsername(string $username): KnPostArchivInterface
186
    {
187
        $this->username = $username;
188
189
        return $this;
190
    }
191
192
    public function getUserId(): ?int
193
    {
194
        return $this->user_id;
195
    }
196
197
    public function getdelUserId(): ?int
198
    {
199
        return $this->del_user_id;
200
    }
201
202
    public function setdelUserId(?int $userid): KnPostArchivInterface
203
    {
204
        $this->del_user_id = $userid;
205
206
        return $this;
207
    }
208
209
    public function getEditDate(): int
210
    {
211
        return $this->lastedit;
212
    }
213
214
    public function setEditDate(int $editDate): KnPostArchivInterface
215
    {
216
        $this->lastedit = $editDate;
217
218
        return $this;
219
    }
220
221
    public function getPlotId(): ?int
222
    {
223
        return $this->plot_id;
224
    }
225
226
    public function getRpgPlot(): ?RpgPlotArchivInterface
227
    {
228
        return $this->rpgPlot;
229
    }
230
231
    public function setRpgPlot(?RpgPlotArchivInterface $rpgPlot): KnPostArchivInterface
232
    {
233
        $this->rpgPlot = $rpgPlot;
234
235
        return $this;
236
    }
237
238
    public function getComments(): Collection
239
    {
240
        return $this->comments;
241
    }
242
243
    public function getRatings(): array
244
    {
245
        return $this->ratings;
246
    }
247
248
    public function setRatings(array $ratings): KnPostArchivInterface
249
    {
250
        $this->ratings = $ratings;
251
        return $this;
252
    }
253
254
    public function getUrl(): string
255
    {
256
        return sprintf(
257
            '/comm.php?%s=1&id=%d',
258
            ShowSingleKn::VIEW_IDENTIFIER,
259
            $this->getId()
260
        );
261
    }
262
}
263