Passed
Pull Request — master (#5072)
by Yannick
18:09 queued 11:34
created

TrackEAttemptQualify::getTrackExercise()   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
declare(strict_types=1);
6
7
namespace Chamilo\CoreBundle\Entity;
8
9
use ApiPlatform\Metadata\ApiResource;
10
use ApiPlatform\Metadata\Get;
11
use DateTime;
12
use Doctrine\ORM\Mapping as ORM;
13
use Gedmo\Mapping\Annotation as Gedmo;
14
15
#[ApiResource(
16
    operations: [
17
        new Get(security: 'is_granted("VIEW", object)'),
18
    ],
19
    security: 'is_granted("ROLE_USER")'
20
)]
21
#[ORM\Table(name: 'track_e_attempt_qualify')]
22
#[ORM\Index(columns: ['exe_id'], name: 'exe_id')]
23
#[ORM\Index(columns: ['question_id'], name: 'question_id')]
24
#[ORM\Index(columns: ['session_id'], name: 'session_id')]
25
#[ORM\Entity]
26
class TrackEAttemptQualify
27
{
28
    #[ORM\Column(name: 'id', type: 'integer')]
29
    #[ORM\Id]
30
    #[ORM\GeneratedValue]
31
    protected ?int $id = null;
32
33
    #[ORM\Column(name: 'question_id', type: 'integer', nullable: false)]
34
    protected int $questionId;
35
36
    #[ORM\Column(name: 'marks', type: 'float', nullable: false)]
37
    protected float $marks;
38
39
    #[Gedmo\Timestampable(on: 'create')]
40
    #[ORM\Column(name: 'insert_date', type: 'datetime', nullable: false)]
41
    protected DateTime $insertDate;
42
43
    #[ORM\Column(name: 'author', type: 'integer', nullable: false)]
44
    protected int $author;
45
46
    #[ORM\Column(name: 'teacher_comment', type: 'text', nullable: false)]
47
    protected string $teacherComment;
48
49
    #[ORM\Column(name: 'session_id', type: 'integer', nullable: false)]
50
    protected int $sessionId;
51
52
    #[ORM\Column(name: 'answer', type: 'text', nullable: true)]
53
    protected ?string $answer;
54
55
    #[ORM\ManyToOne(inversedBy: 'revisedAttempts')]
56
    #[ORM\JoinColumn(name: 'exe_id', referencedColumnName: 'exe_id', nullable: false)]
57
    private ?TrackEExercise $trackExercise = null;
58
59
    public function __construct()
60
    {
61
        $this->teacherComment = '';
62
        $this->answer = null;
63
        $this->sessionId = 0;
64
        $this->author = 0;
65
    }
66
67
    public function getTrackExercise(): ?TrackEExercise
68
    {
69
        return $this->trackExercise;
70
    }
71
    /**
72
     * Set exeId.
73
     * @param ?TrackEExercise $trackExercise
74
     * @return TrackEAttemptQualify
75
     */
76
    public function setTrackExercise(?TrackEExercise $trackExercise): static
77
    {
78
        $this->trackExercise = $trackExercise;
79
80
        return $this;
81
    }
82
83
    public function getQuestionId(): int
84
    {
85
        return $this->questionId;
86
    }
87
88
    /**
89
     * Set questionId.
90
     * @param int $questionId
91
     * @return TrackEAttemptQualify
92
     */
93
    public function setQuestionId(int $questionId): static
94
    {
95
        $this->questionId = $questionId;
96
97
        return $this;
98
    }
99
100
    public function getMarks(): float
101
    {
102
        return $this->marks;
103
    }
104
105
    /**
106
     * Set marks (score).
107
     * @param float $marks
108
     * @return TrackEAttemptQualify
109
     */
110
    public function setMarks(float $marks): self
111
    {
112
        $this->marks = $marks;
113
114
        return $this;
115
    }
116
117
    public function getInsertDate(): DateTime
118
    {
119
        return $this->insertDate;
120
    }
121
122
    /**
123
     * Set insert date.
124
     * @param DateTime $insertDate
125
     * @return TrackEAttemptQualify
126
     */
127
    public function setInsertDate(DateTime $insertDate): self
128
    {
129
        $this->insertDate = $insertDate;
130
131
        return $this;
132
    }
133
134
    public function getAuthor(): int
135
    {
136
        return $this->author;
137
    }
138
139
    /**
140
     * Set author.
141
     * @param int $author
142
     * @return TrackEAttemptQualify
143
     */
144
    public function setAuthor(int $author): static
145
    {
146
        $this->author = $author;
147
148
        return $this;
149
    }
150
151
    public function getTeacherComment(): string
152
    {
153
        return $this->teacherComment;
154
    }
155
156
    /**
157
     * @param string $teacherComment
158
     * @return TrackEAttemptQualify
159
     */
160
    public function setTeacherComment(string $teacherComment): self
161
    {
162
        $this->teacherComment = $teacherComment;
163
164
        return $this;
165
    }
166
167
    public function getSessionId(): int
168
    {
169
        return $this->sessionId;
170
    }
171
172
    /**
173
     * Set sessionId.
174
     * @param int $sessionId
175
     * @return TrackEAttemptQualify
176
     */
177
    public function setSessionId(int $sessionId): static
178
    {
179
        $this->sessionId = $sessionId;
180
181
        return $this;
182
    }
183
184
    public function getId(): ?int
185
    {
186
        return $this->id;
187
    }
188
189
    public function getAnswer(): ?string
190
    {
191
        return $this->answer;
192
    }
193
194
    public function setAnswer(?string $answer): self
195
    {
196
        $this->answer = $answer;
197
198
        return $this;
199
    }
200
}
201