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
|
|
|
|
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 string |
29
|
|
|
* @Assert\NotBlank() |
30
|
|
|
* @Assert\Type("string") |
31
|
|
|
* @ORM\Column(type="string") |
32
|
|
|
*/ |
33
|
|
|
private $type; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var SurveyQuestion |
37
|
|
|
* @Assert\Type("object") |
38
|
|
|
* @Assert\Valid |
39
|
|
|
* @ORM\ManyToOne(targetEntity="SurveyQuestion", inversedBy="answers") |
40
|
|
|
*/ |
41
|
|
|
private $question; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var User |
45
|
|
|
* @Assert\Type("object") |
46
|
|
|
* @Assert\Valid |
47
|
|
|
* @ORM\ManyToOne(targetEntity="User", inversedBy="answers") |
48
|
|
|
*/ |
49
|
|
|
private $user; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var Survey |
53
|
|
|
* @Assert\Type("object") |
54
|
|
|
* @Assert\Valid |
55
|
|
|
* @ORM\ManyToOne(targetEntity="Survey", inversedBy="answers") |
56
|
|
|
*/ |
57
|
|
|
private $survey; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var string |
61
|
|
|
* @Assert\NotBlank() |
62
|
|
|
* @Assert\Type("string") |
63
|
|
|
* @Assert\Length( |
64
|
|
|
* max = 1000 |
65
|
|
|
* ) |
66
|
|
|
* @ORM\Column(name="body", type="text") |
67
|
|
|
*/ |
68
|
|
|
private $content; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Get id. |
72
|
|
|
* |
73
|
|
|
* @return int |
74
|
|
|
*/ |
75
|
|
|
public function getId() |
76
|
|
|
{ |
77
|
|
|
return $this->id; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Set type. |
82
|
|
|
* |
83
|
|
|
* @param string $type |
84
|
|
|
* |
85
|
|
|
* @return SurveyAnswer |
86
|
|
|
*/ |
87
|
|
|
public function setType($type) |
88
|
|
|
{ |
89
|
|
|
$this->type = $type; |
90
|
|
|
|
91
|
|
|
return $this; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Get type. |
96
|
|
|
* |
97
|
|
|
* @return string |
98
|
|
|
*/ |
99
|
|
|
public function getType() |
100
|
|
|
{ |
101
|
|
|
return $this->type; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Set survey question. |
106
|
|
|
* |
107
|
|
|
* @param SurveyQuestion $question |
108
|
|
|
* |
109
|
|
|
* @return SurveyAnswer |
110
|
|
|
*/ |
111
|
|
|
public function setQuestion(SurveyQuestion $question) |
112
|
|
|
{ |
113
|
|
|
$this->question = $question; |
114
|
|
|
|
115
|
|
|
return $this; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Get survey question. |
120
|
|
|
* |
121
|
|
|
* @return SurveyQuestion |
122
|
|
|
*/ |
123
|
|
|
public function getQuestion() |
124
|
|
|
{ |
125
|
|
|
return $this->question; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Set user. |
130
|
|
|
* |
131
|
|
|
* @param User $user |
132
|
|
|
* |
133
|
|
|
* @return SurveyAnswer |
134
|
|
|
*/ |
135
|
|
|
public function setUser(User $user) |
136
|
|
|
{ |
137
|
|
|
$this->user = $user; |
138
|
|
|
|
139
|
|
|
return $this; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Get user. |
144
|
|
|
* |
145
|
|
|
* @return User |
146
|
|
|
*/ |
147
|
|
|
public function getUser() |
148
|
|
|
{ |
149
|
|
|
return $this->user; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* Set survey. |
154
|
|
|
* |
155
|
|
|
* @param Survey $survey |
156
|
|
|
* |
157
|
|
|
* @return SurveyAnswer |
158
|
|
|
*/ |
159
|
|
|
public function setSurvey(Survey $survey) |
160
|
|
|
{ |
161
|
|
|
$this->survey = $survey; |
162
|
|
|
|
163
|
|
|
return $this; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Get survey. |
168
|
|
|
* |
169
|
|
|
* @return Survey |
170
|
|
|
*/ |
171
|
|
|
public function getSurvey() |
172
|
|
|
{ |
173
|
|
|
return $this->survey; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Set content. |
178
|
|
|
* |
179
|
|
|
* @param string $content |
180
|
|
|
* |
181
|
|
|
* @return SurveyAnswer |
182
|
|
|
*/ |
183
|
|
|
public function setContent($content) |
184
|
|
|
{ |
185
|
|
|
$this->content = $content; |
186
|
|
|
|
187
|
|
|
return $this; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* Get content. |
192
|
|
|
* |
193
|
|
|
* @return string |
194
|
|
|
*/ |
195
|
|
|
public function getContent() |
196
|
|
|
{ |
197
|
|
|
return $this->content; |
198
|
|
|
} |
199
|
|
|
} |
200
|
|
|
|