1 | <?php |
||
16 | class Survey |
||
17 | { |
||
18 | use ORMBehaviors\Timestampable\Timestampable; |
||
19 | |||
20 | /** |
||
21 | * @var int |
||
22 | * |
||
23 | * @ORM\Column(type="integer") |
||
24 | * @ORM\Id |
||
25 | * @ORM\GeneratedValue(strategy="AUTO") |
||
26 | * @Groups({"group1"}) |
||
27 | */ |
||
28 | private $id; |
||
29 | |||
30 | /** |
||
31 | * @var SurveyType |
||
32 | * @Assert\Type("object") |
||
33 | * @Assert\Valid |
||
34 | * @ORM\ManyToOne(targetEntity="SurveyType", inversedBy="surveys") |
||
35 | * @Groups({"group1"}) |
||
36 | */ |
||
37 | private $type; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | * @Assert\NotBlank() |
||
42 | * @Assert\Type("string") |
||
43 | * @Assert\Length( |
||
44 | * max = 500 |
||
45 | * ) |
||
46 | * @ORM\Column(type="string") |
||
47 | * @Groups({"group1"}) |
||
48 | */ |
||
49 | private $status = 'current'; |
||
50 | |||
51 | /** |
||
52 | * @var User |
||
53 | * @Assert\Type("object") |
||
54 | * @Assert\Valid |
||
55 | * @ORM\ManyToOne(targetEntity="User", inversedBy="surveys") |
||
56 | */ |
||
57 | private $user; |
||
58 | |||
59 | /** |
||
60 | * @var ArrayCollection[SurveyQuestion] |
||
61 | * @ORM\ManyToMany(targetEntity="SurveyQuestion", mappedBy="surveys") |
||
62 | */ |
||
63 | private $questions; |
||
64 | |||
65 | /** |
||
66 | * @var ArrayCollection[SurveyAnswer] |
||
67 | * @ORM\OneToMany(targetEntity="SurveyAnswer", mappedBy="survey") |
||
68 | * @Groups({"group2"}) |
||
69 | */ |
||
70 | private $answers; |
||
71 | |||
72 | public function __construct() |
||
77 | |||
78 | /** |
||
79 | * Get id. |
||
80 | * |
||
81 | * @return int |
||
82 | */ |
||
83 | public function getId() |
||
87 | |||
88 | /** |
||
89 | * Set type. |
||
90 | * |
||
91 | * @param SurveyType $type |
||
92 | * |
||
93 | * @return Survey |
||
94 | */ |
||
95 | public function setType(SurveyType $type) |
||
105 | |||
106 | /** |
||
107 | * Get type. |
||
108 | * |
||
109 | * @return SurveyType |
||
110 | */ |
||
111 | public function getType() |
||
115 | |||
116 | /** |
||
117 | * Set status. |
||
118 | * |
||
119 | * @param string $status |
||
120 | * |
||
121 | * @return Survey |
||
122 | */ |
||
123 | public function setStatus($status) |
||
129 | |||
130 | /** |
||
131 | * Get status. |
||
132 | * |
||
133 | * @return string |
||
134 | */ |
||
135 | public function getStatus() |
||
139 | |||
140 | /** |
||
141 | * Set user. |
||
142 | * |
||
143 | * @param User $user |
||
144 | * |
||
145 | * @return Survey |
||
146 | */ |
||
147 | public function setUser(User $user) |
||
153 | |||
154 | /** |
||
155 | * Get user. |
||
156 | * |
||
157 | * @return User |
||
158 | */ |
||
159 | public function getUser() |
||
163 | |||
164 | /** |
||
165 | * @param SurveyQuestion $question |
||
166 | * |
||
167 | * @return Survey |
||
168 | */ |
||
169 | public function addQuestion(SurveyQuestion $question) |
||
178 | |||
179 | /** |
||
180 | * Get Questions. |
||
181 | * |
||
182 | * @return ArrayCollection |
||
183 | */ |
||
184 | public function getQuestions() |
||
188 | |||
189 | /** |
||
190 | * Get Questions. |
||
191 | * |
||
192 | * @return ArrayCollection |
||
193 | */ |
||
194 | public function getAnswers() |
||
195 | { |
||
196 | return $this->answers; |
||
197 | } |
||
198 | |||
199 | /** |
||
200 | * Get DateTime. |
||
201 | * |
||
202 | * @return \DateTime |
||
203 | * @Groups({"group1", "group2"}) |
||
204 | */ |
||
205 | public function getCreatedAt() |
||
209 | |||
210 | /** |
||
211 | * Get DateTime. |
||
212 | * |
||
213 | * @return \DateTime |
||
214 | * @Groups({"group1", "group2"}) |
||
215 | */ |
||
216 | public function getUpdatedAt() |
||
220 | } |
||
221 |