Passed
Push — dev ( 41c964...d79ab9 )
by Janko
13:43 queued 04:40
created

PrivateMessage::setInboxPm()   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\OneToOne;
15
use Doctrine\ORM\Mapping\Table;
16
17
/**
18
 * @Entity(repositoryClass="Stu\Orm\Repository\PrivateMessageRepository")
19
 * @Table(
20
 *     name="stu_pms",
21
 *     indexes={
22
 *         @Index(name="recipient_folder_idx", columns={"recip_user", "cat_id"}),
23
 *         @Index(name="correspondence", columns={"recip_user", "send_user"})
24
 *     }
25
 * )
26
 **/
27
class PrivateMessage implements PrivateMessageInterface
28
{
29
    /**
30
     * @Id
31
     * @Column(type="integer")
32
     * @GeneratedValue(strategy="IDENTITY")
33
     *
34
     */
35
    private int $id;
36
37
    /**
38
     * @Column(type="integer")
39
     *
40
     */
41
    private int $send_user = 0;
42
43
    /**
44
     * @Column(type="integer")
45
     *
46
     */
47
    private int $recip_user = 0;
48
49
    /**
50
     * @Column(type="text")
51
     *
52
     */
53
    private string $text = '';
54
55
    /**
56
     * @Column(type="integer")
57
     *
58
     */
59
    private int $date = 0;
60
61
    /**
62
     * @Column(type="boolean")
63
     *
64
     */
65
    private bool $new = false;
66
67
    /**
68
     * @Column(type="boolean")
69
     *
70
     */
71
    private bool $replied = false;
72
73
    /**
74
     * @Column(type="integer")
75
     *
76
     */
77
    private int $cat_id = 0;
78
79
    /**
80
     * @Column(type="integer", nullable=true)
81
     *
82
     */
83
    private ?int $inbox_pm_id;
84
85
    /**
86
     * @Column(type="string", nullable=true)
87
     *
88
     */
89
    private ?string $href;
90
91
    /**
92
     * @Column(type="integer", nullable=true)
93
     *
94
     */
95
    private ?int $deleted;
96
97
    /**
98
     * @var PrivateMessageFolderInterface
99
     *
100
     * @ManyToOne(targetEntity="PrivateMessageFolder")
101
     * @JoinColumn(name="cat_id", referencedColumnName="id", onDelete="CASCADE")
102
     */
103
    private $category;
104
105
    /**
106
     * @var UserInterface
107
     *
108
     * @ManyToOne(targetEntity="User")
109
     * @JoinColumn(name="send_user", referencedColumnName="id", onDelete="CASCADE")
110
     */
111
    private $sendingUser;
112
113
    /**
114
     * @var UserInterface
115
     *
116
     * @ManyToOne(targetEntity="User")
117
     * @JoinColumn(name="recip_user", referencedColumnName="id", onDelete="CASCADE")
118
     */
119
    private $receivingUser;
120
121
    /**
122
     * @OneToOne(targetEntity="PrivateMessage")
123
     * @JoinColumn(name="inbox_pm_id", referencedColumnName="id", onDelete="CASCADE")
124
     */
125
    private ?PrivateMessageInterface $inboxMessage;
126
127
    /**
128
     * @OneToOne(targetEntity="PrivateMessage", mappedBy="inboxMessage", cascade={"remove"})
129
     */
130
    private ?PrivateMessageInterface $outboxMessage;
0 ignored issues
show
introduced by
The private property $outboxMessage is not used, and could be removed.
Loading history...
131
132
    public function getId(): int
133
    {
134
        return $this->id;
135
    }
136
137
    public function getSenderId(): int
138
    {
139
        return $this->send_user;
140
    }
141
142
    public function getRecipientId(): int
143
    {
144
        return $this->recip_user;
145
    }
146
147
    public function getText(): string
148
    {
149
        return $this->text;
150
    }
151
152
    public function setText(string $text): PrivateMessageInterface
153
    {
154
        $this->text = $text;
155
        return $this;
156
    }
157
158
    public function getDate(): int
159
    {
160
        return $this->date;
161
    }
162
163
    public function setDate(int $date): PrivateMessageInterface
164
    {
165
        $this->date = $date;
166
        return $this;
167
    }
168
169
    public function getNew(): bool
170
    {
171
        return $this->new;
172
    }
173
174
    public function setNew(bool $new): PrivateMessageInterface
175
    {
176
        $this->new = $new;
177
        return $this;
178
    }
179
180
    public function getReplied(): bool
181
    {
182
        return $this->replied;
183
    }
184
185
    public function setReplied(bool $replied): PrivateMessageInterface
186
    {
187
        $this->replied = $replied;
188
        return $this;
189
    }
190
191
    public function getCategoryId(): int
192
    {
193
        return $this->cat_id;
194
    }
195
196
    public function setCategoryId(int $categoryId): PrivateMessageInterface
197
    {
198
        $this->cat_id = $categoryId;
199
        return $this;
200
    }
201
202
    public function getInboxPmId(): ?int
203
    {
204
        return $this->inbox_pm_id;
205
    }
206
207
    public function setInboxPmId(?int $pmId): PrivateMessageInterface
208
    {
209
        $this->inbox_pm_id = $pmId;
210
        return $this;
211
    }
212
213
    public function getInboxPm(): ?PrivateMessageInterface
214
    {
215
        return $this->inboxMessage;
216
    }
217
218
    public function setInboxPm(?PrivateMessageInterface $inboxPm): PrivateMessageInterface
219
    {
220
        $this->inboxMessage = $inboxPm;
221
        return $this;
222
    }
223
224
    public function getHref(): ?string
225
    {
226
        return $this->href;
227
    }
228
229
    public function setHref(?string $href): PrivateMessageInterface
230
    {
231
        $this->href = $href;
232
        return $this;
233
    }
234
235
    public function getCategory(): PrivateMessageFolderInterface
236
    {
237
        return $this->category;
238
    }
239
240
    public function setCategory(PrivateMessageFolderInterface $folder): PrivateMessageInterface
241
    {
242
        $this->category = $folder;
243
        return $this;
244
    }
245
246
    public function getSender(): UserInterface
247
    {
248
        return $this->sendingUser;
249
    }
250
251
    public function setSender(UserInterface $user): PrivateMessageInterface
252
    {
253
        $this->sendingUser = $user;
254
        return $this;
255
    }
256
257
    public function getRecipient(): UserInterface
258
    {
259
        return $this->receivingUser;
260
    }
261
262
    public function setRecipient(UserInterface $recipient): PrivateMessageInterface
263
    {
264
        $this->receivingUser = $recipient;
265
        return $this;
266
    }
267
268
    public function setDeleted(int $timestamp): PrivateMessageInterface
269
    {
270
        $this->deleted = $timestamp;
271
272
        return $this;
273
    }
274
}
275