|
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(name: 'c_quiz_rel_question')] |
|
16
|
|
|
#[ORM\Index(name: 'question', columns: ['question_id'])] |
|
17
|
|
|
#[ORM\Index(name: 'exercise', columns: ['quiz_id'])] |
|
18
|
|
|
#[ORM\Entity] |
|
19
|
|
|
class CQuizRelQuestion |
|
20
|
|
|
{ |
|
21
|
|
|
#[ORM\Column(name: 'iid', type: 'integer')] |
|
22
|
|
|
#[ORM\Id] |
|
23
|
|
|
#[ORM\GeneratedValue] |
|
24
|
|
|
protected ?int $iid = null; |
|
25
|
|
|
|
|
26
|
|
|
#[ORM\Column(name: 'question_order', type: 'integer', nullable: false)] |
|
27
|
|
|
protected int $questionOrder; |
|
28
|
|
|
|
|
29
|
|
|
#[Assert\NotBlank] |
|
30
|
|
|
#[ORM\ManyToOne(targetEntity: CQuizQuestion::class, cascade: ['persist'], inversedBy: 'relQuizzes')] |
|
31
|
|
|
#[ORM\JoinColumn(name: 'question_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] |
|
32
|
|
|
protected CQuizQuestion $question; |
|
33
|
|
|
|
|
34
|
|
|
#[Assert\NotBlank] |
|
35
|
|
|
#[ORM\ManyToOne(targetEntity: CQuiz::class, cascade: ['persist'], inversedBy: 'questions')] |
|
36
|
|
|
#[ORM\JoinColumn(name: 'quiz_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] |
|
37
|
|
|
protected CQuiz $quiz; |
|
38
|
|
|
|
|
39
|
|
|
#[ORM\Column(name: 'destination', type: 'text', nullable: true)] |
|
40
|
|
|
protected ?string $destination = null; |
|
41
|
|
|
|
|
42
|
|
|
public function setQuestionOrder(int $questionOrder): self |
|
43
|
|
|
{ |
|
44
|
|
|
$this->questionOrder = $questionOrder; |
|
45
|
|
|
|
|
46
|
|
|
return $this; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function getQuestion(): CQuizQuestion |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->question; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function setQuestion(CQuizQuestion $question): self |
|
55
|
|
|
{ |
|
56
|
|
|
$this->question = $question; |
|
57
|
|
|
|
|
58
|
|
|
return $this; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Get questionOrder. |
|
63
|
|
|
* |
|
64
|
|
|
* @return int |
|
65
|
|
|
*/ |
|
66
|
|
|
public function getQuestionOrder() |
|
67
|
|
|
{ |
|
68
|
|
|
return $this->questionOrder; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function getQuiz(): CQuiz |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->quiz; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
public function setQuiz(CQuiz $quiz): self |
|
77
|
|
|
{ |
|
78
|
|
|
$this->quiz = $quiz; |
|
79
|
|
|
|
|
80
|
|
|
return $this; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function getDestination(): ?string |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->destination; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public function setDestination(?string $destination): self |
|
89
|
|
|
{ |
|
90
|
|
|
$this->destination = $destination; |
|
91
|
|
|
|
|
92
|
|
|
return $this; |
|
93
|
|
|
} |
|
94
|
|
|
} |
|
95
|
|
|
|