Passed
Pull Request — master (#2178)
by Nico
24:52 queued 14:43
created

KnPostArchiv::__construct()   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 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Orm\Entity;
6
7
use Doctrine\ORM\Mapping\Column;
8
use Doctrine\ORM\Mapping\Entity;
9
use Doctrine\ORM\Mapping\GeneratedValue;
10
use Doctrine\ORM\Mapping\Id;
11
use Doctrine\ORM\Mapping\Index;
12
use Doctrine\ORM\Mapping\Table;
13
use Doctrine\ORM\Mapping\UniqueConstraint;
14
use Stu\Module\Communication\View\ShowSingleKn\ShowSingleKn;
15
use Stu\Orm\Repository\KnPostArchivRepository;
16
17
#[Table(name: 'stu_kn_archiv')]
18
#[Index(name: 'plot_archiv_idx', columns: ['plot_id'])]
19
#[Index(name: 'kn_post_archiv_date_idx', columns: ['date'])]
20
#[UniqueConstraint(name: 'unique_kn_archiv_former_id', columns: ['former_id'])]
21
#[Entity(repositoryClass: KnPostArchivRepository::class)]
22
class KnPostArchiv
23
{
24
    #[Id]
25
    #[Column(type: 'integer')]
26
    #[GeneratedValue(strategy: 'IDENTITY')]
27
    private int $id;
28
29
    #[Column(type: 'string')]
30
    private string $version = '';
31
32
    #[Column(type: 'integer')]
33
    private int $former_id;
34
35
    #[Column(type: 'string', nullable: true)]
36
    private ?string $titel = null;
37
38
    #[Column(type: 'text')]
39
    private string $text = '';
40
41
    #[Column(type: 'integer')]
42
    private int $date = 0;
43
44
    #[Column(type: 'string')]
45
    private string $username = '';
46
47
    #[Column(type: 'integer')]
48
    private int $user_id = 0;
49
50
    #[Column(type: 'integer', nullable: true)]
51
    private ?int $del_user_id = 0;
52
53
    #[Column(type: 'integer', nullable: true)]
54
    private ?int $lastedit = 0;
55
56
    #[Column(type: 'integer', nullable: true)]
57
    private ?int $plot_id = null;
58
59
    /**
60
     * @var array<mixed>
61
     */
62
    #[Column(type: 'json')]
63
    private array $ratings = [];
64
65
    /**
66
     * @var array<int>|null
67
     */
68
    #[Column(type: 'json', nullable: true)]
69
    private ?array $refs = null;
70
71 1
    public function getId(): int
72
    {
73 1
        return $this->id;
74
    }
75
76
    public function getVersion(): ?string
77
    {
78
        return $this->version;
79
    }
80
81 1
    public function getFormerId(): int
82
    {
83 1
        return $this->former_id;
84
    }
85
86 1
    public function getTitle(): ?string
87
    {
88 1
        return $this->titel;
89
    }
90
91
    public function setTitle(string $title): KnPostArchiv
92
    {
93
        $this->titel = $title;
94
        return $this;
95
    }
96
97 1
    public function getText(): string
98
    {
99 1
        return $this->text;
100
    }
101
102
    public function setText(string $text): KnPostArchiv
103
    {
104
        $this->text = $text;
105
        return $this;
106
    }
107
108 1
    public function getDate(): int
109
    {
110 1
        return $this->date;
111
    }
112
113
    public function setDate(int $date): KnPostArchiv
114
    {
115
        $this->date = $date;
116
        return $this;
117
    }
118
119 1
    public function getUsername(): string
120
    {
121 1
        return $this->username;
122
    }
123
124
    public function setUsername(string $username): KnPostArchiv
125
    {
126
        $this->username = $username;
127
        return $this;
128
    }
129
130 1
    public function getUserId(): ?int
131
    {
132 1
        return $this->user_id;
133
    }
134
135 1
    public function getdelUserId(): ?int
136
    {
137 1
        return $this->del_user_id;
138
    }
139
140
    public function setdelUserId(?int $userid): KnPostArchiv
141
    {
142
        $this->del_user_id = $userid;
143
        return $this;
144
    }
145
146 1
    public function getEditDate(): ?int
147
    {
148 1
        return $this->lastedit;
149
    }
150
151
    public function setEditDate(int $editDate): KnPostArchiv
152
    {
153
        $this->lastedit = $editDate;
154
        return $this;
155
    }
156
157 1
    public function getPlotId(): ?int
158
    {
159 1
        return $this->plot_id;
160
    }
161
162
    /**
163
     * @return array<mixed>
164
     */
165 1
    public function getRatings(): array
166
    {
167 1
        return $this->ratings;
168
    }
169
170
    /**
171
     * @param array<mixed> $ratings
172
     */
173
    public function setRatings(array $ratings): KnPostArchiv
174
    {
175
        $this->ratings = $ratings;
176
        return $this;
177
    }
178
179
    /**
180
     * @return array<int>|null
181
     */
182 1
    public function getRefs(): ?array
183
    {
184 1
        return $this->refs;
185
    }
186
187
    /**
188
     * @param array<int>|null $refs
189
     */
190
    public function setRefs(?array $refs): KnPostArchiv
191
    {
192
        $this->refs = $refs;
193
        return $this;
194
    }
195
196
    public function getUrl(): string
197
    {
198
        return sprintf(
199
            '/comm.php?%s=1&knid=%d',
200
            ShowSingleKn::VIEW_IDENTIFIER,
201
            $this->getId()
202
        );
203
    }
204
}
205