| @@ 272-301 (lines=30) @@ | ||
| 269 | * @param array $data |
|
| 270 | * @return \PlaygroundGame\Entity\Game |
|
| 271 | */ |
|
| 272 | public function createForm(array $data, $game, $form = null) |
|
| 273 | { |
|
| 274 | $title =''; |
|
| 275 | $description = ''; |
|
| 276 | ||
| 277 | if ($data['form_jsonified']) { |
|
| 278 | $jsonPV = json_decode($data['form_jsonified']); |
|
| 279 | foreach ($jsonPV as $element) { |
|
| 280 | if ($element->form_properties) { |
|
| 281 | $attributes = $element->form_properties[0]; |
|
| 282 | $title = $attributes->title; |
|
| 283 | $description = $attributes->description; |
|
| 284 | ||
| 285 | break; |
|
| 286 | } |
|
| 287 | } |
|
| 288 | } |
|
| 289 | if (!$form) { |
|
| 290 | $form = new \PlaygroundGame\Entity\PostVoteForm(); |
|
| 291 | } |
|
| 292 | $form->setPostvote($game); |
|
| 293 | $form->setTitle($title); |
|
| 294 | $form->setDescription($description); |
|
| 295 | $form->setForm($data['form_jsonified']); |
|
| 296 | $form->setFormTemplate($data['form_template']); |
|
| 297 | ||
| 298 | $form = $this->getPostVoteFormMapper()->insert($form); |
|
| 299 | ||
| 300 | return $form; |
|
| 301 | } |
|
| 302 | ||
| 303 | public function findArrayOfValidatedPosts($game, $user, $filter, $search = '') |
|
| 304 | { |
|
| @@ 2025-2054 (lines=30) @@ | ||
| 2022 | * @param array $data |
|
| 2023 | * @return \PlaygroundGame\Entity\Game |
|
| 2024 | */ |
|
| 2025 | public function createForm(array $data, $game, $form = null) |
|
| 2026 | { |
|
| 2027 | $title = ''; |
|
| 2028 | $description = ''; |
|
| 2029 | ||
| 2030 | if ($data['form_jsonified']) { |
|
| 2031 | $jsonPV = json_decode($data['form_jsonified']); |
|
| 2032 | foreach ($jsonPV as $element) { |
|
| 2033 | if ($element->form_properties) { |
|
| 2034 | $attributes = $element->form_properties[0]; |
|
| 2035 | $title = $attributes->title; |
|
| 2036 | $description = $attributes->description; |
|
| 2037 | ||
| 2038 | break; |
|
| 2039 | } |
|
| 2040 | } |
|
| 2041 | } |
|
| 2042 | if (! $form) { |
|
| 2043 | $form = new \PlaygroundGame\Entity\PlayerForm(); |
|
| 2044 | } |
|
| 2045 | $form->setGame($game); |
|
| 2046 | $form->setTitle($title); |
|
| 2047 | $form->setDescription($description); |
|
| 2048 | $form->setForm($data['form_jsonified']); |
|
| 2049 | $form->setFormTemplate($data['form_template']); |
|
| 2050 | ||
| 2051 | $form = $this->getPlayerFormMapper()->insert($form); |
|
| 2052 | ||
| 2053 | return $form; |
|
| 2054 | } |
|
| 2055 | ||
| 2056 | /** |
|
| 2057 | * getCSV creates lines of CSV and returns it. |
|