Passed
Pull Request — master (#2177)
by Nico
30:59 queued 20:55
created

KnPostArchiv::setRpgPlot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 3
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 1
    public function getId(): int
66
    {
67 1
        return $this->id;
68
    }
69
70 1
    public function getVersion(): ?string
71
    {
72 1
        return $this->version;
73
    }
74
75 1
    public function getFormerId(): int
76
    {
77 1
        return $this->former_id;
78
    }
79
80 1
    public function getTitle(): ?string
81
    {
82 1
        return $this->titel;
83
    }
84
85
    public function setTitle(string $title): KnPostArchiv
86
    {
87
        $this->titel = $title;
88
        return $this;
89
    }
90
91 1
    public function getText(): string
92
    {
93 1
        return $this->text;
94
    }
95
96
    public function setText(string $text): KnPostArchiv
97
    {
98
        $this->text = $text;
99
        return $this;
100
    }
101
102 1
    public function getDate(): int
103
    {
104 1
        return $this->date;
105
    }
106
107
    public function setDate(int $date): KnPostArchiv
108
    {
109
        $this->date = $date;
110
        return $this;
111
    }
112
113 1
    public function getUsername(): string
114
    {
115 1
        return $this->username;
116
    }
117
118
    public function setUsername(string $username): KnPostArchiv
119
    {
120
        $this->username = $username;
121
        return $this;
122
    }
123
124 1
    public function getUserId(): ?int
125
    {
126 1
        return $this->user_id;
127
    }
128
129 1
    public function getdelUserId(): ?int
130
    {
131 1
        return $this->del_user_id;
132
    }
133
134
    public function setdelUserId(?int $userid): KnPostArchiv
135
    {
136
        $this->del_user_id = $userid;
137
        return $this;
138
    }
139
140 1
    public function getEditDate(): ?int
141
    {
142 1
        return $this->lastedit;
143
    }
144
145
    public function setEditDate(int $editDate): KnPostArchiv
146
    {
147
        $this->lastedit = $editDate;
148
        return $this;
149
    }
150
151 1
    public function getPlotId(): ?int
152
    {
153 1
        return $this->plot_id;
154
    }
155
156
    /**
157
     * @return array<mixed>
158
     */
159 1
    public function getRatings(): array
160
    {
161 1
        return $this->ratings;
162
    }
163
164
    /**
165
     * @param array<mixed> $ratings
166
     */
167
    public function setRatings(array $ratings): KnPostArchiv
168
    {
169
        $this->ratings = $ratings;
170
        return $this;
171
    }
172
173
    public function getUrl(): string
174
    {
175
        return sprintf(
176
            '/comm.php?%s=1&knid=%d',
177
            ShowSingleKn::VIEW_IDENTIFIER,
178
            $this->getId()
179
        );
180
    }
181
}
182