Completed
Pull Request — master (#30)
by nonanerz
18:57
created

SurveyAnswer   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 124
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 76.47%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 124
ccs 13
cts 17
cp 0.7647
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setQuestion() 0 6 1
A getQuestion() 0 4 1
A setSurvey() 0 6 1
A getSurvey() 0 4 1
A setContent() 0 6 1
A getContent() 0 4 1
1
<?php
2
3
namespace AppBundle\Entity\Survey;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
7
use Symfony\Component\Validator\Constraints as Assert;
8
9
/**
10
 * SurveyAnswer.
11
 *
12
 * @ORM\Entity(repositoryClass="AppBundle\Repository\SurveyAnswerRepository")
13
 */
14
class SurveyAnswer
15
{
16
    use ORMBehaviors\Timestampable\Timestampable;
17
18
    /**
19
     * @var int
20
     *
21
     * @ORM\Column(type="integer")
22
     * @ORM\Id
23
     * @ORM\GeneratedValue(strategy="AUTO")
24
     */
25
    private $id;
26
27
    /**
28
     * @var SurveyQuestion
29
     * @Assert\Type("object")
30
     * @Assert\Valid
31
     * @ORM\ManyToOne(targetEntity="SurveyQuestion", inversedBy="answers")
32
     * @ORM\JoinColumn(onDelete="CASCADE")
33
     */
34
    private $question;
35
36
    /**
37
     * @var Survey
38
     * @Assert\Type("object")
39
     * @Assert\Valid
40
     * @ORM\ManyToOne(targetEntity="Survey", inversedBy="answers")
41
     * @ORM\JoinColumn(onDelete="CASCADE")
42
     */
43
    private $survey;
44
45
    /**
46
     * @var string
47
     * @Assert\NotBlank()
48
     * @Assert\Type("string")
49
     * @Assert\Length(
50
     *      max = 1000
51
     * )
52
     * @ORM\Column(name="body", type="text")
53
     */
54
    private $content;
55
56
    /**
57
     * Get id.
58
     *
59
     * @return int
60
     */
61
    public function getId()
62
    {
63
        return $this->id;
64
    }
65
66
    /**
67
     * Set survey question.
68
     *
69
     * @param SurveyQuestion $question
70
     *
71
     * @return SurveyAnswer
72
     */
73 1
    public function setQuestion(SurveyQuestion $question)
74
    {
75 1
        $this->question = $question;
76
77 1
        return $this;
78
    }
79
80
    /**
81
     * Get survey question.
82
     *
83
     * @return SurveyQuestion
84
     */
85 3
    public function getQuestion()
86
    {
87 3
        return $this->question;
88
    }
89
90
    /**
91
     * Set survey.
92
     *
93
     * @param Survey $survey
94
     *
95
     * @return SurveyAnswer
96
     */
97 1
    public function setSurvey(Survey $survey)
98
    {
99 1
        $this->survey = $survey;
100
101 1
        return $this;
102
    }
103
104
    /**
105
     * Get survey.
106
     *
107
     * @return Survey
108
     */
109
    public function getSurvey()
110
    {
111
        return $this->survey;
112
    }
113
114
    /**
115
     * Set content.
116
     *
117
     * @param string $content
118
     *
119
     * @return SurveyAnswer
120
     */
121 1
    public function setContent($content)
122
    {
123 1
        $this->content = $content;
124
125 1
        return $this;
126
    }
127
128
    /**
129
     * Get content.
130
     *
131
     * @return string
132
     */
133 2
    public function getContent()
134
    {
135 2
        return $this->content;
136
    }
137
}
138