Passed
Push — master ( ff47af...4fe9ef )
by Julito
08:21
created

CForumPost::getPostParentId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CourseBundle\Entity;
6
7
use Chamilo\CoreBundle\Entity\Resource\AbstractResource;
8
use Chamilo\CoreBundle\Entity\Resource\ResourceInterface;
9
use Doctrine\ORM\Mapping as ORM;
10
11
/**
12
 * CForumPost.
13
 *
14
 * @ORM\Table(
15
 *  name="c_forum_post",
16
 *  indexes={
17
 *      @ORM\Index(name="course", columns={"c_id"}),
18
 *      @ORM\Index(name="poster_id", columns={"poster_id"}),
19
 *      @ORM\Index(name="forum_id", columns={"forum_id"}),
20
 *      @ORM\Index(name="idx_forum_post_thread_id", columns={"thread_id"}),
21
 *      @ORM\Index(name="idx_forum_post_visible", columns={"visible"}),
22
 *      @ORM\Index(name="c_id_visible_post_date", columns={"c_id", "visible", "post_date"})
23
 *  }
24
 * )
25
 * @ORM\Entity()
26
 */
27
class CForumPost extends AbstractResource implements ResourceInterface
28
{
29
    public const STATUS_VALIDATED = 1;
30
    public const STATUS_WAITING_MODERATION = 2;
31
    public const STATUS_REJECTED = 3;
32
33
    /**
34
     * @var int
35
     *
36
     * @ORM\Column(name="iid", type="integer")
37
     * @ORM\Id
38
     * @ORM\GeneratedValue
39
     */
40
    protected $iid;
41
42
    /**
43
     * @var int
44
     *
45
     * @ORM\Column(name="c_id", type="integer")
46
     */
47
    protected $cId;
48
49
    /**
50
     * @var int
51
     *
52
     * @ORM\Column(name="post_id", type="integer")
53
     */
54
    protected $postId;
55
56
    /**
57
     * @var string
58
     *
59
     * @ORM\Column(name="post_title", type="string", length=250, nullable=true)
60
     */
61
    protected $postTitle;
62
63
    /**
64
     * @var string
65
     *
66
     * @ORM\Column(name="post_text", type="text", nullable=true)
67
     */
68
    protected $postText;
69
70
    /**
71
     * @var CForumThread|null
72
     *
73
     * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumThread", inversedBy="posts")
74
     * @ORM\JoinColumn(name="thread_id", referencedColumnName="iid")
75
     */
76
    protected $thread;
77
78
    /**
79
     * @var int
80
     *
81
     * @ORM\Column(name="forum_id", type="integer", nullable=true)
82
     */
83
    protected $forumId;
84
85
    /**
86
     * @var int
87
     *
88
     * @ORM\Column(name="poster_id", type="integer", nullable=true)
89
     */
90
    protected $posterId;
91
92
    /**
93
     * @var string
94
     *
95
     * @ORM\Column(name="poster_name", type="string", length=100, nullable=true)
96
     */
97
    protected $posterName;
98
99
    /**
100
     * @var \DateTime
101
     *
102
     * @ORM\Column(name="post_date", type="datetime", nullable=true)
103
     */
104
    protected $postDate;
105
106
    /**
107
     * @var bool
108
     *
109
     * @ORM\Column(name="post_notification", type="boolean", nullable=true)
110
     */
111
    protected $postNotification;
112
113
    /**
114
     * @var int
115
     *
116
     * @ORM\Column(name="post_parent_id", type="integer", nullable=true)
117
     */
118
    protected $postParentId;
119
120
    /**
121
     * @var bool
122
     *
123
     * @ORM\Column(name="visible", type="boolean", nullable=true)
124
     */
125
    protected $visible;
126
127
    /**
128
     * @var int
129
     *
130
     * @ORM\Column(name="status", type="integer", nullable=true)
131
     */
132
    protected $status;
133
134
    public function __construct()
135
    {
136
    }
137
138
    public function __toString(): string
139
    {
140
        return (string) $this->getPostTitle();
141
    }
142
143
    /**
144
     * Set postTitle.
145
     *
146
     * @param string $postTitle
147
     *
148
     * @return CForumPost
149
     */
150
    public function setPostTitle($postTitle)
151
    {
152
        $this->postTitle = $postTitle;
153
154
        return $this;
155
    }
156
157
    /**
158
     * Get postTitle.
159
     *
160
     * @return string
161
     */
162
    public function getPostTitle()
163
    {
164
        return $this->postTitle;
165
    }
166
167
    /**
168
     * Set postText.
169
     *
170
     * @param string $postText
171
     *
172
     * @return CForumPost
173
     */
174
    public function setPostText($postText)
175
    {
176
        $this->postText = $postText;
177
178
        return $this;
179
    }
180
181
    /**
182
     * Get postText.
183
     *
184
     * @return string
185
     */
186
    public function getPostText()
187
    {
188
        return $this->postText;
189
    }
190
191
    /**
192
     * Set thread.
193
     *
194
     * @return CForumPost
195
     */
196
    public function setThread(CForumThread $thread = null)
197
    {
198
        $this->thread = $thread;
199
200
        return $this;
201
    }
202
203
    /**
204
     * Get thread.
205
     *
206
     * @return CForumThread|null
207
     */
208
    public function getThread()
209
    {
210
        return $this->thread;
211
    }
212
213
    /**
214
     * Set forumId.
215
     *
216
     * @param int $forumId
217
     *
218
     * @return CForumPost
219
     */
220
    public function setForumId($forumId)
221
    {
222
        $this->forumId = $forumId;
223
224
        return $this;
225
    }
226
227
    /**
228
     * Get forumId.
229
     *
230
     * @return int
231
     */
232
    public function getForumId()
233
    {
234
        return $this->forumId;
235
    }
236
237
    /**
238
     * Set posterId.
239
     *
240
     * @param int $posterId
241
     *
242
     * @return CForumPost
243
     */
244
    public function setPosterId($posterId)
245
    {
246
        $this->posterId = $posterId;
247
248
        return $this;
249
    }
250
251
    /**
252
     * Get posterId.
253
     *
254
     * @return int
255
     */
256
    public function getPosterId()
257
    {
258
        return $this->posterId;
259
    }
260
261
    /**
262
     * Set posterName.
263
     *
264
     * @param string $posterName
265
     *
266
     * @return CForumPost
267
     */
268
    public function setPosterName($posterName)
269
    {
270
        $this->posterName = $posterName;
271
272
        return $this;
273
    }
274
275
    /**
276
     * Get posterName.
277
     *
278
     * @return string
279
     */
280
    public function getPosterName()
281
    {
282
        return $this->posterName;
283
    }
284
285
    /**
286
     * Set postDate.
287
     *
288
     * @param \DateTime $postDate
289
     *
290
     * @return CForumPost
291
     */
292
    public function setPostDate($postDate)
293
    {
294
        $this->postDate = $postDate;
295
296
        return $this;
297
    }
298
299
    /**
300
     * Get postDate.
301
     *
302
     * @return \DateTime
303
     */
304
    public function getPostDate()
305
    {
306
        return $this->postDate;
307
    }
308
309
    /**
310
     * Set postNotification.
311
     *
312
     * @param bool $postNotification
313
     *
314
     * @return CForumPost
315
     */
316
    public function setPostNotification($postNotification)
317
    {
318
        $this->postNotification = $postNotification;
319
320
        return $this;
321
    }
322
323
    /**
324
     * Get postNotification.
325
     *
326
     * @return bool
327
     */
328
    public function getPostNotification()
329
    {
330
        return $this->postNotification;
331
    }
332
333
    /**
334
     * Set postParentId.
335
     *
336
     * @param int $postParentId
337
     *
338
     * @return CForumPost
339
     */
340
    public function setPostParentId($postParentId)
341
    {
342
        $this->postParentId = $postParentId;
343
344
        return $this;
345
    }
346
347
    /**
348
     * Get postParentId.
349
     *
350
     * @return int
351
     */
352
    public function getPostParentId()
353
    {
354
        return $this->postParentId;
355
    }
356
357
    /**
358
     * Set visible.
359
     *
360
     * @param bool $visible
361
     *
362
     * @return CForumPost
363
     */
364
    public function setVisible($visible)
365
    {
366
        $this->visible = $visible;
367
368
        return $this;
369
    }
370
371
    /**
372
     * Get visible.
373
     *
374
     * @return bool
375
     */
376
    public function getVisible()
377
    {
378
        return $this->visible;
379
    }
380
381
    /**
382
     * Set postId.
383
     *
384
     * @param int $postId
385
     *
386
     * @return CForumPost
387
     */
388
    public function setPostId($postId)
389
    {
390
        $this->postId = $postId;
391
392
        return $this;
393
    }
394
395
    /**
396
     * Get postId.
397
     *
398
     * @return int
399
     */
400
    public function getPostId()
401
    {
402
        return $this->postId;
403
    }
404
405
    /**
406
     * Set cId.
407
     *
408
     * @param int $cId
409
     *
410
     * @return CForumPost
411
     */
412
    public function setCId($cId)
413
    {
414
        $this->cId = $cId;
415
416
        return $this;
417
    }
418
419
    /**
420
     * Get cId.
421
     *
422
     * @return int
423
     */
424
    public function getCId()
425
    {
426
        return $this->cId;
427
    }
428
429
    /**
430
     * @return int
431
     */
432
    public function getStatus()
433
    {
434
        return $this->status;
435
    }
436
437
    /**
438
     * @param int $status
439
     *
440
     * @return CForumPost
441
     */
442
    public function setStatus($status)
443
    {
444
        $this->status = $status;
445
446
        return $this;
447
    }
448
449
    /**
450
     * Get iid.
451
     *
452
     * @return int
453
     */
454
    public function getIid()
455
    {
456
        return $this->iid;
457
    }
458
459
    /**
460
     * Resource identifier.
461
     */
462
    public function getResourceIdentifier(): int
463
    {
464
        return $this->getIid();
465
    }
466
467
    public function getResourceName(): string
468
    {
469
        return $this->getPostTitle();
470
    }
471
}
472