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

KnCommentArchiv::setPostId()   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\JoinColumn;
12
use Doctrine\ORM\Mapping\ManyToOne;
13
use Doctrine\ORM\Mapping\Table;
14
use Doctrine\ORM\Mapping\UniqueConstraint;
15
use Stu\Orm\Repository\KnCommentArchivRepository;
16
17
#[Table(name: 'stu_kn_comments_archiv')]
18
#[UniqueConstraint(name: 'unique_comments_former_id', columns: ['former_id'])]
19
#[Entity(repositoryClass: KnCommentArchivRepository::class)]
20
class KnCommentArchiv
21
{
22
    #[Id]
23
    #[Column(type: 'integer')]
24
    #[GeneratedValue(strategy: 'IDENTITY')]
25
    private int $id;
26
27
    #[Column(type: 'string')]
28
    private string $version = '';
29
30
    #[Column(type: 'integer')]
31
    private int $former_id = 0;
32
33
    #[Column(type: 'integer')]
34
    private int $post_id = 0;
35
36
    #[Column(type: 'integer')]
37
    private int $user_id = 0;
38
39
    #[Column(type: 'string')]
40
    private string $username = '';
41
42
    #[Column(type: 'string')]
43
    private string $text = '';
44
45
    #[Column(type: 'integer')]
46
    private int $date = 0;
47
48
    #[Column(type: 'integer', nullable: true)]
49
    private ?int $deleted = null;
50
51
    public function getId(): int
52
    {
53
        return $this->id;
54
    }
55
56
    public function getVersion(): ?string
57
    {
58
        return $this->version;
59
    }
60
61
    public function getFormerId(): int
62
    {
63
        return $this->former_id;
64
    }
65
66
    public function getKnId(): int
67
    {
68
        return $this->post_id;
69
    }
70
71
    public function setPostId(int $postId): KnCommentArchiv
72
    {
73
        $this->post_id = $postId;
74
75
        return $this;
76
    }
77
78
    public function getUserId(): int
79
    {
80
        return $this->user_id;
81
    }
82
83
    public function getUsername(): string
84
    {
85
        return $this->username;
86
    }
87
88
    public function setUsername(string $username): KnCommentArchiv
89
    {
90
        $this->username = $username;
91
92
        return $this;
93
    }
94
95
    public function getText(): string
96
    {
97
        return $this->text;
98
    }
99
100
    public function setText(string $text): KnCommentArchiv
101
    {
102
        $this->text = $text;
103
104
        return $this;
105
    }
106
107
    public function getDate(): int
108
    {
109
        return $this->date;
110
    }
111
112
    public function setDate(int $date): KnCommentArchiv
113
    {
114
        $this->date = $date;
115
116
        return $this;
117
    }
118
119
    public function setDeleted(int $timestamp): KnCommentArchiv
120
    {
121
        $this->deleted = $timestamp;
122
123
        return $this;
124
    }
125
126
    public function isDeleted(): bool
127
    {
128
        return $this->deleted !== null;
129
    }
130
}
131