1 | <?php |
||
15 | class SurveyQuestion |
||
16 | { |
||
17 | /** |
||
18 | * @var int |
||
19 | * |
||
20 | * @ORM\Column(type="integer") |
||
21 | * @ORM\Id |
||
22 | * @ORM\GeneratedValue(strategy="AUTO") |
||
23 | * @Groups({"group2", "group3", "group4"}) |
||
24 | */ |
||
25 | private $id; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | * @Assert\NotBlank() |
||
30 | * @Assert\Type("string") |
||
31 | * @Assert\Length( |
||
32 | * max = 500 |
||
33 | * ) |
||
34 | * @ORM\Column(type="string") |
||
35 | * @Groups({"group2"}) |
||
36 | */ |
||
37 | private $title; |
||
38 | |||
39 | /** |
||
40 | * @var SurveyTypeSection |
||
41 | * @Assert\Type("object") |
||
42 | * @Assert\Valid |
||
43 | * @ORM\ManyToOne(targetEntity="SurveyTypeSection", inversedBy="questions") |
||
44 | * @ORM\JoinColumn(onDelete="SET NULL") |
||
45 | */ |
||
46 | private $surveyTypeSection; |
||
47 | |||
48 | /** |
||
49 | * @var int |
||
50 | * @Assert\NotBlank() |
||
51 | * @Assert\Type("integer") |
||
52 | * @ORM\Column(type="integer") |
||
53 | * @Groups({"group2"}) |
||
54 | */ |
||
55 | private $orderNumber; |
||
56 | |||
57 | /** |
||
58 | * @var array |
||
59 | * @Assert\NotBlank() |
||
60 | * @Assert\Type("array") |
||
61 | * @ORM\Column(type="array") |
||
62 | * @Groups({"group2"}) |
||
63 | */ |
||
64 | private $variants; |
||
65 | |||
66 | /** |
||
67 | * @var ArrayCollection[SurveyAnswer] |
||
68 | * @ORM\OneToMany(targetEntity="SurveyAnswer", mappedBy="question", cascade={"persist", "remove"}) |
||
69 | */ |
||
70 | private $answers; |
||
71 | |||
72 | public function __construct() |
||
77 | |||
78 | /** |
||
79 | * Get id. |
||
80 | * |
||
81 | * @return int |
||
82 | */ |
||
83 | 3 | public function getId() |
|
87 | |||
88 | /** |
||
89 | * Set title. |
||
90 | * |
||
91 | * @param string $title |
||
92 | * |
||
93 | * @return SurveyQuestion |
||
94 | */ |
||
95 | public function setTitle($title) |
||
101 | |||
102 | /** |
||
103 | * Get title. |
||
104 | * |
||
105 | * @return string |
||
106 | */ |
||
107 | 3 | public function getTitle() |
|
111 | |||
112 | /** |
||
113 | * Set Survey Type Section. |
||
114 | * |
||
115 | * @param SurveyTypeSection $section |
||
116 | * |
||
117 | * @return SurveyQuestion |
||
118 | */ |
||
119 | public function setSurveyTypeSection(SurveyTypeSection $section) |
||
125 | |||
126 | /** |
||
127 | * Get Survey Type. |
||
128 | * |
||
129 | * @return SurveyTypeSection |
||
130 | */ |
||
131 | public function getSurveyTypeSection() |
||
135 | |||
136 | /** |
||
137 | * Set order number. |
||
138 | * |
||
139 | * @param int $number |
||
140 | * |
||
141 | * @return SurveyQuestion |
||
142 | */ |
||
143 | public function setOrderNumber($number) |
||
149 | |||
150 | /** |
||
151 | * Get order number. |
||
152 | * |
||
153 | * @return int |
||
154 | */ |
||
155 | public function getOrderNumber() |
||
159 | |||
160 | /** |
||
161 | * Set variants. |
||
162 | * |
||
163 | * @param array $variants |
||
164 | * |
||
165 | * @return SurveyQuestion |
||
166 | */ |
||
167 | public function setVariants($variants) |
||
173 | |||
174 | /** |
||
175 | * Add variant. |
||
176 | * |
||
177 | * @param string $variant |
||
178 | * |
||
179 | * @return SurveyQuestion |
||
180 | */ |
||
181 | public function addVariant($variant) |
||
189 | |||
190 | /** |
||
191 | * Get variants. |
||
192 | * |
||
193 | * @return array |
||
194 | */ |
||
195 | 4 | public function getVariants() |
|
199 | |||
200 | /** |
||
201 | * Get answers. |
||
202 | * |
||
203 | * @return ArrayCollection |
||
204 | */ |
||
205 | public function getAnswers() |
||
209 | |||
210 | /** |
||
211 | * Add answer |
||
212 | * |
||
213 | * @param \AppBundle\Entity\Survey\SurveyAnswer $answer |
||
214 | * |
||
215 | * @return SurveyQuestion |
||
216 | */ |
||
217 | public function addAnswer(\AppBundle\Entity\Survey\SurveyAnswer $answer) |
||
223 | |||
224 | /** |
||
225 | * Remove answer |
||
226 | * |
||
227 | * @param \AppBundle\Entity\Survey\SurveyAnswer $answer |
||
228 | */ |
||
229 | public function removeAnswer(\AppBundle\Entity\Survey\SurveyAnswer $answer) |
||
233 | } |
||
234 |