|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Chamilo\CourseBundle\Entity; |
|
6
|
|
|
|
|
7
|
|
|
/* For licensing terms, see /license.txt */ |
|
8
|
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Entity\User; |
|
10
|
|
|
use Chamilo\CoreBundle\Traits\UserTrait; |
|
11
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
12
|
|
|
|
|
13
|
|
|
#[ORM\Table(name: 'c_blog_rating')] |
|
14
|
|
|
#[ORM\Entity] |
|
15
|
|
|
class CBlogRating |
|
16
|
|
|
{ |
|
17
|
|
|
use UserTrait; |
|
18
|
|
|
|
|
19
|
|
|
#[ORM\Column(name: 'iid', type: 'integer')] |
|
20
|
|
|
#[ORM\Id] |
|
21
|
|
|
#[ORM\GeneratedValue] |
|
22
|
|
|
protected ?int $iid = null; |
|
23
|
|
|
|
|
24
|
|
|
#[ORM\Column(name: 'rating_type', type: 'string', length: 40, nullable: false)] |
|
25
|
|
|
protected string $ratingType; |
|
26
|
|
|
|
|
27
|
|
|
#[ORM\Column(name: 'rating', type: 'integer', nullable: false)] |
|
28
|
|
|
protected int $rating; |
|
29
|
|
|
|
|
30
|
|
|
#[ORM\ManyToOne(targetEntity: CBlog::class)] |
|
31
|
|
|
#[ORM\JoinColumn(name: 'blog_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] |
|
32
|
|
|
protected ?CBlog $blog = null; |
|
33
|
|
|
|
|
34
|
|
|
#[ORM\ManyToOne(targetEntity: User::class)] |
|
35
|
|
|
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
36
|
|
|
protected User $user; |
|
37
|
|
|
|
|
38
|
|
|
public function getIid(): ?int |
|
39
|
|
|
{ |
|
40
|
|
|
return $this->iid; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function getRatingType(): string |
|
44
|
|
|
{ |
|
45
|
|
|
return $this->ratingType; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function setRatingType(string $ratingType): self |
|
49
|
|
|
{ |
|
50
|
|
|
$this->ratingType = $ratingType; |
|
51
|
|
|
|
|
52
|
|
|
return $this; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function getRating(): int |
|
56
|
|
|
{ |
|
57
|
|
|
return $this->rating; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function setRating(int $rating): self |
|
61
|
|
|
{ |
|
62
|
|
|
$this->rating = $rating; |
|
63
|
|
|
|
|
64
|
|
|
return $this; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
public function getBlog(): ?CBlog |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->blog; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
public function setBlog(?CBlog $blog): self |
|
73
|
|
|
{ |
|
74
|
|
|
$this->blog = $blog; |
|
75
|
|
|
|
|
76
|
|
|
return $this; |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|