Passed
Push — master ( 727abb...ceefce )
by Yannick
07:55 queued 14s
created

CQuizQuestionOption::getName()   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
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
 * CQuizQuestionOption.
14
 */
15
#[ORM\Table(name: 'c_quiz_question_option')]
16
#[ORM\Entity]
17
class CQuizQuestionOption
18
{
19
    #[ORM\Column(name: 'iid', type: 'integer')]
20
    #[ORM\Id]
21
    #[ORM\GeneratedValue]
22
    protected ?int $iid = null;
23
24
    #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)]
25
    protected string $title;
26
27
    #[ORM\Column(name: 'position', type: 'integer', nullable: false)]
28
    protected int $position;
29
30
    #[Assert\NotBlank]
31
    #[ORM\ManyToOne(targetEntity: CQuizQuestion::class, cascade: ['persist'], inversedBy: 'options')]
32
    #[ORM\JoinColumn(name: 'question_id', referencedColumnName: 'iid', onDelete: 'CASCADE')]
33
    protected CQuizQuestion $question;
34
35
    public function setTitle(string $title): self
36
    {
37
        $this->title = $title;
38
39
        return $this;
40
    }
41
42
    /**
43
     * Get name.
44
     *
45
     * @return string
46
     */
47
    public function getTitle()
48
    {
49
        return $this->title;
50
    }
51
52
    public function setPosition(int $position): self
53
    {
54
        $this->position = $position;
55
56
        return $this;
57
    }
58
59
    /**
60
     * Get position.
61
     *
62
     * @return int
63
     */
64
    public function getPosition()
65
    {
66
        return $this->position;
67
    }
68
69
    public function getQuestion(): CQuizQuestion
70
    {
71
        return $this->question;
72
    }
73
74
    public function setQuestion(CQuizQuestion $question): self
75
    {
76
        $this->question = $question;
77
78
        return $this;
79
    }
80
}
81