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

CForumThread::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
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\Common\Collections\ArrayCollection;
10
use Doctrine\ORM\Mapping as ORM;
11
12
/**
13
 * CForumThread.
14
 *
15
 * @ORM\Table(
16
 *  name="c_forum_thread",
17
 *  indexes={
18
 *      @ORM\Index(name="course", columns={"c_id"}),
19
 *      @ORM\Index(name="idx_forum_thread_forum_id", columns={"forum_id"})
20
 *  }
21
 * )
22
 * @ORM\Entity()
23
 */
24
class CForumThread extends AbstractResource implements ResourceInterface
25
{
26
    /**
27
     * @var int
28
     *
29
     * @ORM\Column(name="iid", type="integer")
30
     * @ORM\Id
31
     * @ORM\GeneratedValue
32
     */
33
    protected $iid;
34
35
    /**
36
     * @var int
37
     *
38
     * @ORM\Column(name="c_id", type="integer")
39
     */
40
    protected $cId;
41
42
    /**
43
     * @var int
44
     *
45
     * @ORM\Column(name="thread_id", type="integer")
46
     */
47
    protected $threadId;
48
49
    /**
50
     * @var string
51
     *
52
     * @ORM\Column(name="thread_title", type="string", length=255, nullable=true)
53
     */
54
    protected $threadTitle;
55
56
    /**
57
     * @var CForumForum|null
58
     *
59
     * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumForum", inversedBy="threads")
60
     * @ORM\JoinColumn(name="forum_id", referencedColumnName="iid")
61
     */
62
    protected $forum;
63
64
    /**
65
     * @var int
66
     *
67
     * @ORM\Column(name="thread_replies", type="integer", nullable=false, options={"unsigned":true, "default" = 0})
68
     */
69
    protected $threadReplies;
70
71
    /**
72
     * @var int
73
     *
74
     * @ORM\Column(name="thread_poster_id", type="integer", nullable=true)
75
     */
76
    protected $threadPosterId;
77
78
    /**
79
     * @var string
80
     *
81
     * @ORM\Column(name="thread_poster_name", type="string", length=100, nullable=true)
82
     */
83
    protected $threadPosterName;
84
85
    /**
86
     * @var int
87
     *
88
     * @ORM\Column(name="thread_views", type="integer", nullable=false, options={"unsigned":true, "default" = 0})
89
     */
90
    protected $threadViews;
91
92
    /**
93
     * @var int
94
     *
95
     * @ORM\Column(name="thread_last_post", type="integer", nullable=true)
96
     */
97
    protected $threadLastPost;
98
99
    /**
100
     * @var \DateTime
101
     *
102
     * @ORM\Column(name="thread_date", type="datetime", nullable=true)
103
     */
104
    protected $threadDate;
105
106
    /**
107
     * @var bool
108
     *
109
     * @ORM\Column(name="thread_sticky", type="boolean", nullable=true)
110
     */
111
    protected $threadSticky;
112
113
    /**
114
     * @var int
115
     *
116
     * @ORM\Column(name="locked", type="integer", nullable=false)
117
     */
118
    protected $locked;
119
120
    /**
121
     * @var int
122
     *
123
     * @ORM\Column(name="session_id", type="integer", nullable=true)
124
     */
125
    protected $sessionId;
126
127
    /**
128
     * @var string
129
     *
130
     * @ORM\Column(name="thread_title_qualify", type="string", length=255, nullable=true)
131
     */
132
    protected $threadTitleQualify;
133
134
    /**
135
     * @var float
136
     *
137
     * @ORM\Column(name="thread_qualify_max", type="float", precision=6, scale=2, nullable=false)
138
     */
139
    protected $threadQualifyMax;
140
141
    /**
142
     * @var \DateTime
143
     *
144
     * @ORM\Column(name="thread_close_date", type="datetime", nullable=true)
145
     */
146
    protected $threadCloseDate;
147
148
    /**
149
     * @var float
150
     *
151
     * @ORM\Column(name="thread_weight", type="float", precision=6, scale=2, nullable=false)
152
     */
153
    protected $threadWeight;
154
155
    /**
156
     * @var bool
157
     *
158
     * @ORM\Column(name="thread_peer_qualify", type="boolean")
159
     */
160
    protected $threadPeerQualify;
161
162
    /**
163
     * @var int
164
     *
165
     * @ORM\Column(name="lp_item_id", type="integer", options={"unsigned":true})
166
     */
167
    protected $lpItemId;
168
169
    /**
170
     * @var ArrayCollection
171
     *
172
     * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CForumPost", mappedBy="thread")
173
     */
174
    protected $posts;
175
176
    /**
177
     * @var CItemProperty
178
     */
179
    protected $itemProperty;
180
181
    /**
182
     * Constructor.
183
     */
184
    public function __construct()
185
    {
186
        $this->threadPeerQualify = false;
187
        $this->threadReplies = 0;
188
        $this->threadViews = 0;
189
    }
190
191
    public function __toString(): string
192
    {
193
        return (string) $this->getThreadTitle();
194
    }
195
196
    /**
197
     * @return bool
198
     */
199
    public function isThreadPeerQualify()
200
    {
201
        return $this->threadPeerQualify;
202
    }
203
204
    /**
205
     * set threadPeerQualify.
206
     *
207
     * @param bool $threadPeerQualify
208
     *
209
     * @return $this
210
     */
211
    public function setThreadPeerQualify($threadPeerQualify)
212
    {
213
        $this->threadPeerQualify = $threadPeerQualify;
214
215
        return $this;
216
    }
217
218
    /**
219
     * Set threadTitle.
220
     *
221
     * @param string $threadTitle
222
     *
223
     * @return CForumThread
224
     */
225
    public function setThreadTitle($threadTitle)
226
    {
227
        $this->threadTitle = $threadTitle;
228
229
        return $this;
230
    }
231
232
    /**
233
     * Get threadTitle.
234
     *
235
     * @return string
236
     */
237
    public function getThreadTitle()
238
    {
239
        return $this->threadTitle;
240
    }
241
242
    /**
243
     * Set forum.
244
     *
245
     * @return CForumThread
246
     */
247
    public function setForum(CForumForum $forum = null)
248
    {
249
        $this->forum = $forum;
250
251
        return $this;
252
    }
253
254
    /**
255
     * Get forumId.
256
     *
257
     * @return CForumForum|null
258
     */
259
    public function getForum()
260
    {
261
        return $this->forum;
262
    }
263
264
    /**
265
     * Set threadReplies.
266
     *
267
     * @param int $threadReplies
268
     *
269
     * @return CForumThread
270
     */
271
    public function setThreadReplies($threadReplies)
272
    {
273
        $this->threadReplies = $threadReplies;
274
275
        return $this;
276
    }
277
278
    /**
279
     * Get threadReplies.
280
     *
281
     * @return int
282
     */
283
    public function getThreadReplies()
284
    {
285
        return $this->threadReplies;
286
    }
287
288
    /**
289
     * Set threadPosterId.
290
     *
291
     * @param int $threadPosterId
292
     *
293
     * @return CForumThread
294
     */
295
    public function setThreadPosterId($threadPosterId)
296
    {
297
        $this->threadPosterId = $threadPosterId;
298
299
        return $this;
300
    }
301
302
    /**
303
     * Get threadPosterId.
304
     *
305
     * @return int
306
     */
307
    public function getThreadPosterId()
308
    {
309
        return $this->threadPosterId;
310
    }
311
312
    /**
313
     * Set threadPosterName.
314
     *
315
     * @param string $threadPosterName
316
     *
317
     * @return CForumThread
318
     */
319
    public function setThreadPosterName($threadPosterName)
320
    {
321
        $this->threadPosterName = $threadPosterName;
322
323
        return $this;
324
    }
325
326
    /**
327
     * Get threadPosterName.
328
     *
329
     * @return string
330
     */
331
    public function getThreadPosterName()
332
    {
333
        return $this->threadPosterName;
334
    }
335
336
    /**
337
     * Set threadViews.
338
     *
339
     * @param int $threadViews
340
     *
341
     * @return CForumThread
342
     */
343
    public function setThreadViews($threadViews)
344
    {
345
        $this->threadViews = $threadViews;
346
347
        return $this;
348
    }
349
350
    /**
351
     * Get threadViews.
352
     *
353
     * @return int
354
     */
355
    public function getThreadViews()
356
    {
357
        return $this->threadViews;
358
    }
359
360
    /**
361
     * Set threadLastPost.
362
     *
363
     * @param int $threadLastPost
364
     *
365
     * @return CForumThread
366
     */
367
    public function setThreadLastPost($threadLastPost)
368
    {
369
        $this->threadLastPost = $threadLastPost;
370
371
        return $this;
372
    }
373
374
    /**
375
     * Get threadLastPost.
376
     *
377
     * @return int
378
     */
379
    public function getThreadLastPost()
380
    {
381
        return $this->threadLastPost;
382
    }
383
384
    /**
385
     * Set threadDate.
386
     *
387
     * @param \DateTime $threadDate
388
     *
389
     * @return CForumThread
390
     */
391
    public function setThreadDate($threadDate)
392
    {
393
        $this->threadDate = $threadDate;
394
395
        return $this;
396
    }
397
398
    /**
399
     * Get threadDate.
400
     *
401
     * @return \DateTime
402
     */
403
    public function getThreadDate()
404
    {
405
        return $this->threadDate;
406
    }
407
408
    /**
409
     * Set threadSticky.
410
     *
411
     * @param bool $threadSticky
412
     *
413
     * @return CForumThread
414
     */
415
    public function setThreadSticky($threadSticky)
416
    {
417
        $this->threadSticky = $threadSticky;
418
419
        return $this;
420
    }
421
422
    /**
423
     * Get threadSticky.
424
     *
425
     * @return bool
426
     */
427
    public function getThreadSticky()
428
    {
429
        return $this->threadSticky;
430
    }
431
432
    /**
433
     * Set locked.
434
     *
435
     * @param int $locked
436
     *
437
     * @return CForumThread
438
     */
439
    public function setLocked($locked)
440
    {
441
        $this->locked = $locked;
442
443
        return $this;
444
    }
445
446
    /**
447
     * Get locked.
448
     *
449
     * @return int
450
     */
451
    public function getLocked()
452
    {
453
        return $this->locked;
454
    }
455
456
    /**
457
     * Set sessionId.
458
     *
459
     * @param int $sessionId
460
     *
461
     * @return CForumThread
462
     */
463
    public function setSessionId($sessionId)
464
    {
465
        $this->sessionId = $sessionId;
466
467
        return $this;
468
    }
469
470
    /**
471
     * Get sessionId.
472
     *
473
     * @return int
474
     */
475
    public function getSessionId()
476
    {
477
        return $this->sessionId;
478
    }
479
480
    /**
481
     * Set threadTitleQualify.
482
     *
483
     * @param string $threadTitleQualify
484
     *
485
     * @return CForumThread
486
     */
487
    public function setThreadTitleQualify($threadTitleQualify)
488
    {
489
        $this->threadTitleQualify = $threadTitleQualify;
490
491
        return $this;
492
    }
493
494
    /**
495
     * Get threadTitleQualify.
496
     *
497
     * @return string
498
     */
499
    public function getThreadTitleQualify()
500
    {
501
        return $this->threadTitleQualify;
502
    }
503
504
    /**
505
     * Set threadQualifyMax.
506
     *
507
     * @param float $threadQualifyMax
508
     *
509
     * @return CForumThread
510
     */
511
    public function setThreadQualifyMax($threadQualifyMax)
512
    {
513
        $this->threadQualifyMax = $threadQualifyMax;
514
515
        return $this;
516
    }
517
518
    /**
519
     * Get threadQualifyMax.
520
     *
521
     * @return float
522
     */
523
    public function getThreadQualifyMax()
524
    {
525
        return $this->threadQualifyMax;
526
    }
527
528
    /**
529
     * Set threadCloseDate.
530
     *
531
     * @param \DateTime $threadCloseDate
532
     *
533
     * @return CForumThread
534
     */
535
    public function setThreadCloseDate($threadCloseDate)
536
    {
537
        $this->threadCloseDate = $threadCloseDate;
538
539
        return $this;
540
    }
541
542
    /**
543
     * Get threadCloseDate.
544
     *
545
     * @return \DateTime
546
     */
547
    public function getThreadCloseDate()
548
    {
549
        return $this->threadCloseDate;
550
    }
551
552
    /**
553
     * Set threadWeight.
554
     *
555
     * @param float $threadWeight
556
     *
557
     * @return CForumThread
558
     */
559
    public function setThreadWeight($threadWeight)
560
    {
561
        $this->threadWeight = $threadWeight;
562
563
        return $this;
564
    }
565
566
    /**
567
     * Get threadWeight.
568
     *
569
     * @return float
570
     */
571
    public function getThreadWeight()
572
    {
573
        return $this->threadWeight;
574
    }
575
576
    /**
577
     * Set threadId.
578
     *
579
     * @param int $threadId
580
     *
581
     * @return CForumThread
582
     */
583
    public function setThreadId($threadId)
584
    {
585
        $this->threadId = $threadId;
586
587
        return $this;
588
    }
589
590
    /**
591
     * Get threadId.
592
     *
593
     * @return int
594
     */
595
    public function getThreadId()
596
    {
597
        return $this->threadId;
598
    }
599
600
    /**
601
     * Set cId.
602
     *
603
     * @param int $cId
604
     *
605
     * @return CForumThread
606
     */
607
    public function setCId($cId)
608
    {
609
        $this->cId = $cId;
610
611
        return $this;
612
    }
613
614
    /**
615
     * Get cId.
616
     *
617
     * @return int
618
     */
619
    public function getCId()
620
    {
621
        return $this->cId;
622
    }
623
624
    /**
625
     * Set lpItemId.
626
     *
627
     * @param int $lpItemId
628
     *
629
     * @return $this
630
     */
631
    public function setLpItemId($lpItemId)
632
    {
633
        $this->lpItemId = $lpItemId;
634
635
        return $this;
636
    }
637
638
    /**
639
     * Get lpId.
640
     *
641
     * @return int
642
     */
643
    public function getLpItemId()
644
    {
645
        return $this->lpItemId;
646
    }
647
648
    /**
649
     * Get iid.
650
     *
651
     * @return int
652
     */
653
    public function getIid()
654
    {
655
        return $this->iid;
656
    }
657
658
    /**
659
     * @return ArrayCollection|CForumPost[]
660
     */
661
    public function getPosts()
662
    {
663
        return $this->posts;
664
    }
665
666
    /**
667
     * @return CForumThread
668
     */
669
    public function setItemProperty(CItemProperty $itemProperty)
670
    {
671
        $this->itemProperty = $itemProperty;
672
673
        return $this;
674
    }
675
676
    /**
677
     * @return CItemProperty
678
     */
679
    public function getItemProperty()
680
    {
681
        return $this->itemProperty;
682
    }
683
684
    /**
685
     * Resource identifier.
686
     */
687
    public function getResourceIdentifier(): int
688
    {
689
        return $this->getIid();
690
    }
691
692
    public function getResourceName(): string
693
    {
694
        return $this->getThreadTitle();
695
    }
696
}
697