1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
6
|
|
|
|
7
|
|
|
namespace Chamilo\CourseBundle\Entity; |
8
|
|
|
|
9
|
|
|
use Doctrine\ORM\Mapping as ORM; |
10
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* CQuizRelQuestion. |
14
|
|
|
* |
15
|
|
|
* @ORM\Table( |
16
|
|
|
* name="c_quiz_rel_question", |
17
|
|
|
* indexes={ |
18
|
|
|
* @ORM\Index(name="question", columns={"question_id"}), |
19
|
|
|
* @ORM\Index(name="exercise", columns={"quiz_id"}) |
20
|
|
|
* } |
21
|
|
|
* ) |
22
|
|
|
* @ORM\Entity |
23
|
|
|
*/ |
24
|
|
|
class CQuizRelQuestion |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* @ORM\Column(name="iid", type="integer") |
28
|
|
|
* @ORM\Id |
29
|
|
|
* @ORM\GeneratedValue |
30
|
|
|
*/ |
31
|
|
|
protected int $iid; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @ORM\Column(name="question_order", type="integer", nullable=false) |
35
|
|
|
*/ |
36
|
|
|
protected int $questionOrder; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @ORM\ManyToOne(targetEntity="CQuizQuestion", inversedBy="relQuizzes", cascade={"persist"}) |
40
|
|
|
* @ORM\JoinColumn(name="question_id", referencedColumnName="iid", onDelete="CASCADE") |
41
|
|
|
*/ |
42
|
|
|
#[Assert\NotBlank] |
43
|
|
|
protected CQuizQuestion $question; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @ORM\ManyToOne(targetEntity="CQuiz", inversedBy="questions", cascade={"persist"}) |
47
|
|
|
* @ORM\JoinColumn(name="quiz_id", referencedColumnName="iid", onDelete="CASCADE") |
48
|
|
|
*/ |
49
|
|
|
#[Assert\NotBlank] |
50
|
|
|
protected CQuiz $quiz; |
51
|
|
|
|
52
|
|
|
public function setQuestionOrder(int $questionOrder): self |
53
|
|
|
{ |
54
|
|
|
$this->questionOrder = $questionOrder; |
55
|
|
|
|
56
|
|
|
return $this; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function getQuestion(): CQuizQuestion |
60
|
|
|
{ |
61
|
|
|
return $this->question; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function setQuestion(CQuizQuestion $question): self |
65
|
|
|
{ |
66
|
|
|
$this->question = $question; |
67
|
|
|
|
68
|
|
|
return $this; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Get questionOrder. |
73
|
|
|
* |
74
|
|
|
* @return int |
75
|
|
|
*/ |
76
|
|
|
public function getQuestionOrder() |
77
|
|
|
{ |
78
|
|
|
return $this->questionOrder; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function getQuiz(): CQuiz |
82
|
|
|
{ |
83
|
|
|
return $this->quiz; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function setQuiz(CQuiz $quiz): self |
87
|
|
|
{ |
88
|
|
|
$this->quiz = $quiz; |
89
|
|
|
|
90
|
|
|
return $this; |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
|