Passed
Push — master ( 9e722d...e1631d )
by
unknown
16:56 queued 07:55
created

GradebookCertificate::setPublish()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Entity;
8
9
use Chamilo\CoreBundle\Repository\GradebookCertificateRepository;
10
use Chamilo\CoreBundle\Traits\UserTrait;
11
use DateTime;
12
use Doctrine\ORM\Mapping as ORM;
13
use Gedmo\Mapping\Annotation as Gedmo;
14
15
#[ORM\Table(name: 'gradebook_certificate')]
16
#[ORM\Index(name: 'idx_gradebook_certificate_user_id', columns: ['user_id'])]
17
#[ORM\Entity(repositoryClass: GradebookCertificateRepository::class)]
18
class GradebookCertificate
19
{
20
    use UserTrait;
21
22
    #[ORM\Column(name: 'id', type: 'integer')]
23
    #[ORM\Id]
24
    #[ORM\GeneratedValue]
25
    protected ?int $id = null;
26
27
    #[ORM\ManyToOne(targetEntity: GradebookCategory::class)]
28
    #[ORM\JoinColumn(name: 'cat_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
29
    protected ?GradebookCategory $category = null;
30
31
    #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'gradeBookCertificates')]
32
    #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
33
    protected User $user;
34
35
    #[ORM\Column(name: 'score_certificate', type: 'float', precision: 10, scale: 0, nullable: false)]
36
    protected float $scoreCertificate;
37
38
    #[Gedmo\Timestampable(on: 'create')]
39
    #[ORM\Column(name: 'created_at', type: 'datetime', nullable: false)]
40
    protected DateTime $createdAt;
41
42
    #[ORM\Column(name: 'path_certificate', type: 'text', nullable: true)]
43
    protected ?string $pathCertificate = null;
44
45
    #[ORM\Column(name: 'downloaded_at', type: 'datetime', nullable: true)]
46
    protected ?DateTime $downloadedAt = null;
47
48
    #[ORM\Column(name: 'publish', type: 'boolean', options: ['default' => false])]
49
    protected bool $publish = false;
50
51
    public function setScoreCertificate(float $scoreCertificate): self
52
    {
53
        $this->scoreCertificate = $scoreCertificate;
54
55
        return $this;
56
    }
57
58
    /**
59
     * Get scoreCertificate.
60
     *
61
     * @return float
62
     */
63
    public function getScoreCertificate()
64
    {
65
        return $this->scoreCertificate;
66
    }
67
68
    public function setCreatedAt(DateTime $createdAt): self
69
    {
70
        $this->createdAt = $createdAt;
71
72
        return $this;
73
    }
74
75
    /**
76
     * Get createdAt.
77
     *
78
     * @return DateTime
79
     */
80
    public function getCreatedAt()
81
    {
82
        return $this->createdAt;
83
    }
84
85
    public function setPathCertificate(string $pathCertificate): self
86
    {
87
        $this->pathCertificate = $pathCertificate;
88
89
        return $this;
90
    }
91
92
    /**
93
     * Get pathCertificate.
94
     *
95
     * @return string
96
     */
97
    public function getPathCertificate()
98
    {
99
        return $this->pathCertificate;
100
    }
101
102
    /**
103
     * Get id.
104
     *
105
     * @return int
106
     */
107
    public function getId()
108
    {
109
        return $this->id;
110
    }
111
112
    public function getDownloadedAt(): DateTime
113
    {
114
        return $this->downloadedAt;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->downloadedAt could return the type null which is incompatible with the type-hinted return DateTime. Consider adding an additional type-check to rule them out.
Loading history...
115
    }
116
117
    public function setDownloadedAt(DateTime $downloadedAt): self
118
    {
119
        $this->downloadedAt = $downloadedAt;
120
121
        return $this;
122
    }
123
124
    public function getCategory(): ?GradebookCategory
125
    {
126
        return $this->category;
127
    }
128
129
    public function setCategory(GradebookCategory $category): self
130
    {
131
        $this->category = $category;
132
133
        return $this;
134
    }
135
136
    public function getUser(): User
137
    {
138
        return $this->user;
139
    }
140
141
    public function setUser(User $user): self
142
    {
143
        $this->user = $user;
144
145
        return $this;
146
    }
147
148
    public function setPublish(bool $publish): self
149
    {
150
        $this->publish = $publish;
151
152
        return $this;
153
    }
154
155
    public function getPublish(): bool
156
    {
157
        return $this->publish;
158
    }
159
}
160