Passed
Pull Request — master (#2311)
by Nico
07:31 queued 02:09
created

NPCQuestLog::setQuest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
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 4
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\JoinColumn;
13
use Doctrine\ORM\Mapping\ManyToOne;
14
use Doctrine\ORM\Mapping\Table;
15
use Stu\Orm\Repository\NPCQuestLogRepository;
16
17
#[Table(name: 'stu_npc_quest_log')]
18
#[Index(name: 'npc_quest_log_quest_idx', columns: ['quest_id'])]
19
#[Index(name: 'npc_quest_log_user_idx', columns: ['user_id'])]
20
#[Entity(repositoryClass: NPCQuestLogRepository::class)]
21
class NPCQuestLog
22
{
23
    #[Id]
24
    #[Column(type: 'integer')]
25
    #[GeneratedValue(strategy: 'IDENTITY')]
26
    private int $id;
27
28
    #[Column(type: 'integer')]
29
    private int $quest_id = 0;
30
31
    #[Column(type: 'integer')]
32
    private int $user_id = 0;
33
34
    #[Column(type: 'text')]
35
    private string $text = '';
36
37
    #[Column(type: 'integer')]
38
    private int $date = 0;
39
40
    #[Column(type: 'integer', nullable: true)]
41
    private ?int $deleted = null;
42
43
    #[Column(type: 'integer')]
44
    private int $mode = 0;
45
46
    #[ManyToOne(targetEntity: NPCQuest::class)]
47
    #[JoinColumn(name: 'quest_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
48
    private ?NPCQuest $quest = null;
49
50
    #[ManyToOne(targetEntity: User::class)]
51
    #[JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
52
    private ?User $user = null;
53
54
    public function getId(): int
55
    {
56
        return $this->id;
57
    }
58
59
    public function getQuestId(): int
60
    {
61
        return $this->quest_id;
62
    }
63
64
    public function setQuestId(int $questId): NPCQuestLog
65
    {
66
        $this->quest_id = $questId;
67
        return $this;
68
    }
69
70
    public function getQuest(): ?NPCQuest
71
    {
72
        return $this->quest;
73
    }
74
75
    public function setQuest(?NPCQuest $quest): NPCQuestLog
76
    {
77
        $this->quest = $quest;
78
        return $this;
79
    }
80
81
    public function getUserId(): int
82
    {
83
        return $this->user_id;
84
    }
85
86
    public function setUserId(int $userId): NPCQuestLog
87
    {
88
        $this->user_id = $userId;
89
        return $this;
90
    }
91
92
    public function getUser(): ?User
93
    {
94
        return $this->user;
95
    }
96
97
    public function setUser(?User $user): NPCQuestLog
98
    {
99
        $this->user = $user;
100
        return $this;
101
    }
102
103
    public function getText(): string
104
    {
105
        return $this->text;
106
    }
107
108
    public function setText(string $text): NPCQuestLog
109
    {
110
        $this->text = $text;
111
        return $this;
112
    }
113
114
    public function getDate(): int
115
    {
116
        return $this->date;
117
    }
118
119
    public function setDate(int $date): NPCQuestLog
120
    {
121
        $this->date = $date;
122
        return $this;
123
    }
124
125
    public function getDeleted(): ?int
126
    {
127
        return $this->deleted;
128
    }
129
130
    public function setDeleted(?int $deleted): NPCQuestLog
131
    {
132
        $this->deleted = $deleted;
133
        return $this;
134
    }
135
136
    public function getMode(): int
137
    {
138
        return $this->mode;
139
    }
140
141
    public function setMode(int $mode): NPCQuestLog
142
    {
143
        $this->mode = $mode;
144
        return $this;
145
    }
146
}