Completed
Pull Request — dev (#24)
by
unknown
11:35
created

SurveyAnswer::setSurvey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace AppBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
7
use Symfony\Component\Validator\Constraints as Assert;
8
use Symfony\Component\Serializer\Annotation\Groups;
9
10
/**
11
 * SurveyAnswer.
12
 *
13
 * @ORM\Entity(repositoryClass="AppBundle\Repository\SurveyAnswerRepository")
14
 */
15
class SurveyAnswer
16
{
17
    use ORMBehaviors\Timestampable\Timestampable;
18
19
    /**
20
     * @var int
21
     *
22
     * @ORM\Column(type="integer")
23
     * @ORM\Id
24
     * @ORM\GeneratedValue(strategy="AUTO")
25
     */
26
    private $id;
27
28
    /**
29
     * @var string
30
     * @Assert\Type("string")
31
     * @ORM\Column(type="string", nullable=true)
32
     */
33
    private $type;
34
35
    /**
36
     * @var SurveyQuestion
37
     * @Assert\Type("object")
38
     * @Assert\Valid
39
     * @ORM\ManyToOne(targetEntity="SurveyQuestion", inversedBy="answers")
40
     * @Groups({"group3"})
41
     */
42
    private $question;
43
44
    /**
45
     * @var Survey
46
     * @Assert\Type("object")
47
     * @Assert\Valid
48
     * @ORM\ManyToOne(targetEntity="Survey", inversedBy="answers")
49
     */
50
    private $survey;
51
52
    /**
53
     * @var string
54
     * @Assert\NotBlank()
55
     * @Assert\Type("string")
56
     * @Assert\Length(
57
     *      max = 1000
58
     * )
59
     * @ORM\Column(name="body", type="text")
60
     * @Groups({"group3"})
61
     */
62
    private $content;
63
64
    /**
65
     * Get id.
66
     *
67
     * @return int
68
     */
69
    public function getId()
70
    {
71
        return $this->id;
72
    }
73
74
    /**
75
     * Set type.
76
     *
77
     * @param string $type
78
     *
79
     * @return SurveyAnswer
80
     */
81
    public function setType($type)
82
    {
83
        $this->type = $type;
84
85
        return $this;
86
    }
87
88
    /**
89
     * Get type.
90
     *
91
     * @return string
92
     */
93
    public function getType()
94
    {
95
        return $this->type;
96
    }
97
98
    /**
99
     * Set survey question.
100
     *
101
     * @param SurveyQuestion $question
102
     *
103
     * @return SurveyAnswer
104
     */
105 1
    public function setQuestion(SurveyQuestion $question)
106
    {
107 1
        $this->question = $question;
108
109 1
        return $this;
110
    }
111
112
    /**
113
     * Get survey question.
114
     *
115
     * @return SurveyQuestion
116
     */
117 2
    public function getQuestion()
118
    {
119 2
        return $this->question;
120
    }
121
122
    /**
123
     * Set survey.
124
     *
125
     * @param Survey $survey
126
     *
127
     * @return SurveyAnswer
128
     */
129 1
    public function setSurvey(Survey $survey)
130
    {
131 1
        $this->survey = $survey;
132
133 1
        return $this;
134
    }
135
136
    /**
137
     * Get survey.
138
     *
139
     * @return Survey
140
     */
141
    public function getSurvey()
142
    {
143
        return $this->survey;
144
    }
145
146
    /**
147
     * Set content.
148
     *
149
     * @param string $content
150
     *
151
     * @return SurveyAnswer
152
     */
153 1
    public function setContent($content)
154
    {
155 1
        $this->content = $content;
156
157 1
        return $this;
158
    }
159
160
    /**
161
     * Get content.
162
     *
163
     * @return string
164
     */
165 2
    public function getContent()
166
    {
167 2
        return $this->content;
168
    }
169
}
170