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) |
||
101 | |||
102 | /** |
||
103 | * Get type. |
||
104 | * |
||
105 | * @return SurveyType |
||
106 | */ |
||
107 | public function getType() |
||
111 | |||
112 | /** |
||
113 | * Set status. |
||
114 | * |
||
115 | * @param string $status |
||
116 | * |
||
117 | * @return Survey |
||
118 | */ |
||
119 | public function setStatus($status) |
||
125 | |||
126 | /** |
||
127 | * Get status. |
||
128 | * |
||
129 | * @return string |
||
130 | */ |
||
131 | public function getStatus() |
||
135 | |||
136 | /** |
||
137 | * Set user. |
||
138 | * |
||
139 | * @param User $user |
||
140 | * |
||
141 | * @return Survey |
||
142 | */ |
||
143 | public function setUser(User $user) |
||
149 | |||
150 | /** |
||
151 | * Get user. |
||
152 | * |
||
153 | * @return User |
||
154 | */ |
||
155 | public function getUser() |
||
159 | |||
160 | /** |
||
161 | * @param SurveyQuestion $question |
||
162 | * |
||
163 | * @return Survey |
||
164 | */ |
||
165 | public function setQuestions(SurveyQuestion $question) |
||
174 | |||
175 | /** |
||
176 | * Get Questions. |
||
177 | * |
||
178 | * @return ArrayCollection |
||
179 | */ |
||
180 | public function getQuestions() |
||
184 | |||
185 | /** |
||
186 | * Get Questions. |
||
187 | * |
||
188 | * @return ArrayCollection |
||
189 | */ |
||
190 | public function getAnswers() |
||
191 | { |
||
192 | return $this->answers; |
||
193 | } |
||
194 | |||
195 | /** |
||
196 | * Get DateTime. |
||
197 | * |
||
198 | * @return \DateTime |
||
199 | * @Groups({"group1", "group2"}) |
||
200 | */ |
||
201 | public function getCreatedAt() |
||
205 | |||
206 | /** |
||
207 | * Get DateTime. |
||
208 | * |
||
209 | * @return \DateTime |
||
210 | * @Groups({"group1", "group2"}) |
||
211 | */ |
||
212 | public function getUpdatedAt() |
||
216 | } |
||
217 |