|
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
|
|
|
use Override; |
|
|
|
|
|
|
17
|
|
|
use Stu\Orm\Repository\PrivateMessageRepository; |
|
18
|
|
|
|
|
19
|
|
|
#[Table(name: 'stu_pms')] |
|
20
|
|
|
#[Index(name: 'recipient_folder_idx', columns: ['recip_user', 'cat_id'])] |
|
21
|
|
|
#[Index(name: 'correspondence', columns: ['recip_user', 'send_user'])] |
|
22
|
|
|
#[Entity(repositoryClass: PrivateMessageRepository::class)] |
|
23
|
|
|
class PrivateMessage implements PrivateMessageInterface |
|
24
|
|
|
{ |
|
25
|
|
|
#[Id] |
|
26
|
|
|
#[Column(type: 'integer')] |
|
27
|
|
|
#[GeneratedValue(strategy: 'IDENTITY')] |
|
28
|
|
|
private int $id; |
|
29
|
|
|
|
|
30
|
|
|
#[Column(type: 'integer')] |
|
31
|
|
|
private int $send_user = 0; |
|
32
|
|
|
|
|
33
|
|
|
#[Column(type: 'integer')] |
|
34
|
|
|
private int $recip_user = 0; |
|
35
|
|
|
|
|
36
|
|
|
#[Column(type: 'text')] |
|
37
|
|
|
private string $text = ''; |
|
38
|
|
|
|
|
39
|
|
|
#[Column(type: 'integer')] |
|
40
|
|
|
private int $date = 0; |
|
41
|
|
|
|
|
42
|
|
|
#[Column(type: 'boolean')] |
|
43
|
|
|
private bool $new = false; |
|
44
|
|
|
|
|
45
|
|
|
#[Column(type: 'integer')] |
|
46
|
|
|
private int $cat_id = 0; |
|
47
|
|
|
|
|
48
|
|
|
#[Column(type: 'integer', nullable: true)] |
|
49
|
|
|
private ?int $inbox_pm_id = null; |
|
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
#[Column(type: 'string', nullable: true)] |
|
52
|
|
|
private ?string $href = null; |
|
53
|
|
|
|
|
54
|
|
|
#[Column(type: 'integer', nullable: true)] |
|
55
|
|
|
private ?int $deleted = null; |
|
56
|
|
|
|
|
57
|
|
|
#[ManyToOne(targetEntity: 'PrivateMessageFolder')] |
|
58
|
|
|
#[JoinColumn(name: 'cat_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
59
|
|
|
private PrivateMessageFolderInterface $category; |
|
60
|
|
|
|
|
61
|
|
|
#[ManyToOne(targetEntity: 'User')] |
|
62
|
|
|
#[JoinColumn(name: 'send_user', referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
63
|
|
|
private UserInterface $sendingUser; |
|
64
|
|
|
|
|
65
|
|
|
#[ManyToOne(targetEntity: 'User')] |
|
66
|
|
|
#[JoinColumn(name: 'recip_user', referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
67
|
|
|
private UserInterface $receivingUser; |
|
68
|
|
|
|
|
69
|
|
|
#[OneToOne(targetEntity: 'PrivateMessage', inversedBy: 'outboxPm')] |
|
70
|
|
|
#[JoinColumn(name: 'inbox_pm_id', referencedColumnName: 'id')] |
|
71
|
|
|
private ?PrivateMessageInterface $inboxPm = null; |
|
72
|
|
|
|
|
73
|
|
|
#[OneToOne(targetEntity: 'PrivateMessage', mappedBy: 'inboxPm')] |
|
74
|
|
|
private ?PrivateMessageInterface $outboxPm = null; |
|
75
|
|
|
|
|
76
|
1 |
|
#[Override] |
|
77
|
|
|
public function getId(): int |
|
78
|
|
|
{ |
|
79
|
1 |
|
return $this->id; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
1 |
|
#[Override] |
|
83
|
|
|
public function getSenderId(): int |
|
84
|
|
|
{ |
|
85
|
1 |
|
return $this->send_user; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
#[Override] |
|
89
|
|
|
public function getRecipientId(): int |
|
90
|
|
|
{ |
|
91
|
|
|
return $this->recip_user; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
1 |
|
#[Override] |
|
95
|
|
|
public function getText(): string |
|
96
|
|
|
{ |
|
97
|
1 |
|
return $this->text; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
#[Override] |
|
101
|
|
|
public function setText(string $text): PrivateMessageInterface |
|
102
|
|
|
{ |
|
103
|
|
|
$this->text = $text; |
|
104
|
|
|
return $this; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
1 |
|
#[Override] |
|
108
|
|
|
public function getDate(): int |
|
109
|
|
|
{ |
|
110
|
1 |
|
return $this->date; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
#[Override] |
|
114
|
|
|
public function setDate(int $date): PrivateMessageInterface |
|
115
|
|
|
{ |
|
116
|
|
|
$this->date = $date; |
|
117
|
|
|
return $this; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
1 |
|
#[Override] |
|
121
|
|
|
public function getNew(): bool |
|
122
|
|
|
{ |
|
123
|
1 |
|
return $this->new; |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
#[Override] |
|
127
|
|
|
public function setNew(bool $new): PrivateMessageInterface |
|
128
|
|
|
{ |
|
129
|
|
|
$this->new = $new; |
|
130
|
|
|
return $this; |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
#[Override] |
|
134
|
|
|
public function getCategoryId(): int |
|
135
|
|
|
{ |
|
136
|
|
|
return $this->cat_id; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
#[Override] |
|
140
|
|
|
public function setCategoryId(int $categoryId): PrivateMessageInterface |
|
141
|
|
|
{ |
|
142
|
|
|
$this->cat_id = $categoryId; |
|
143
|
|
|
return $this; |
|
144
|
|
|
} |
|
145
|
|
|
|
|
146
|
1 |
|
#[Override] |
|
147
|
|
|
public function getInboxPm(): ?PrivateMessageInterface |
|
148
|
|
|
{ |
|
149
|
1 |
|
return $this->inboxPm; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
#[Override] |
|
153
|
|
|
public function setInboxPm(?PrivateMessageInterface $pm): PrivateMessageInterface |
|
154
|
|
|
{ |
|
155
|
|
|
$this->inboxPm = $pm; |
|
156
|
|
|
return $this; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
#[Override] |
|
160
|
|
|
public function getOutboxPm(): ?PrivateMessageInterface |
|
161
|
|
|
{ |
|
162
|
|
|
return $this->outboxPm; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
1 |
|
#[Override] |
|
166
|
|
|
public function getHref(): ?string |
|
167
|
|
|
{ |
|
168
|
1 |
|
return $this->href; |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
#[Override] |
|
172
|
|
|
public function setHref(?string $href): PrivateMessageInterface |
|
173
|
|
|
{ |
|
174
|
|
|
$this->href = $href; |
|
175
|
|
|
return $this; |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
1 |
|
#[Override] |
|
179
|
|
|
public function getCategory(): PrivateMessageFolderInterface |
|
180
|
|
|
{ |
|
181
|
1 |
|
return $this->category; |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
#[Override] |
|
185
|
|
|
public function setCategory(PrivateMessageFolderInterface $folder): PrivateMessageInterface |
|
186
|
|
|
{ |
|
187
|
|
|
$this->category = $folder; |
|
188
|
|
|
return $this; |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
1 |
|
#[Override] |
|
192
|
|
|
public function getSender(): UserInterface |
|
193
|
|
|
{ |
|
194
|
1 |
|
return $this->sendingUser; |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
#[Override] |
|
198
|
|
|
public function setSender(UserInterface $user): PrivateMessageInterface |
|
199
|
|
|
{ |
|
200
|
|
|
$this->sendingUser = $user; |
|
201
|
|
|
return $this; |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
1 |
|
#[Override] |
|
205
|
|
|
public function getRecipient(): UserInterface |
|
206
|
|
|
{ |
|
207
|
1 |
|
return $this->receivingUser; |
|
208
|
|
|
} |
|
209
|
|
|
|
|
210
|
|
|
#[Override] |
|
211
|
|
|
public function setRecipient(UserInterface $recipient): PrivateMessageInterface |
|
212
|
|
|
{ |
|
213
|
|
|
$this->receivingUser = $recipient; |
|
214
|
|
|
return $this; |
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
1 |
|
#[Override] |
|
218
|
|
|
public function isDeleted(): bool |
|
219
|
|
|
{ |
|
220
|
1 |
|
return $this->deleted !== null; |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
#[Override] |
|
224
|
|
|
public function setDeleted(int $timestamp): PrivateMessageInterface |
|
225
|
|
|
{ |
|
226
|
|
|
$this->deleted = $timestamp; |
|
227
|
|
|
|
|
228
|
|
|
return $this; |
|
229
|
|
|
} |
|
230
|
|
|
|
|
231
|
|
|
#[Override] |
|
232
|
|
|
public function hasTranslation(): bool |
|
233
|
|
|
{ |
|
234
|
|
|
$text = $this->getText(); |
|
235
|
|
|
return strpos($text, '[translate]') !== false && strpos($text, '[/translate]') !== false; |
|
236
|
|
|
} |
|
237
|
|
|
} |
|
238
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths