| @@ 324-353 (lines=30) @@ | ||
| 321 | * @param array $data |
|
| 322 | * @return \PlaygroundGame\Entity\Game |
|
| 323 | */ |
|
| 324 | public function createForm(array $data, $game, $form = null) |
|
| 325 | { |
|
| 326 | $title =''; |
|
| 327 | $description = ''; |
|
| 328 | ||
| 329 | if ($data['form_jsonified']) { |
|
| 330 | $jsonPV = json_decode($data['form_jsonified']); |
|
| 331 | foreach ($jsonPV as $element) { |
|
| 332 | if ($element->form_properties) { |
|
| 333 | $attributes = $element->form_properties[0]; |
|
| 334 | $title = $attributes->title; |
|
| 335 | $description = $attributes->description; |
|
| 336 | ||
| 337 | break; |
|
| 338 | } |
|
| 339 | } |
|
| 340 | } |
|
| 341 | if (!$form) { |
|
| 342 | $form = new \PlaygroundGame\Entity\PostVoteForm(); |
|
| 343 | } |
|
| 344 | $form->setPostvote($game); |
|
| 345 | $form->setTitle($title); |
|
| 346 | $form->setDescription($description); |
|
| 347 | $form->setForm($data['form_jsonified']); |
|
| 348 | $form->setFormTemplate($data['form_template']); |
|
| 349 | ||
| 350 | $form = $this->getPostVoteFormMapper()->insert($form); |
|
| 351 | ||
| 352 | return $form; |
|
| 353 | } |
|
| 354 | ||
| 355 | public function findArrayOfValidatedPosts($game, $user, $filter, $search = '') |
|
| 356 | { |
|
| @@ 2117-2146 (lines=30) @@ | ||
| 2114 | * @param array $data |
|
| 2115 | * @return \PlaygroundGame\Entity\Game |
|
| 2116 | */ |
|
| 2117 | public function createForm(array $data, $game, $form = null) |
|
| 2118 | { |
|
| 2119 | $title = ''; |
|
| 2120 | $description = ''; |
|
| 2121 | ||
| 2122 | if ($data['form_jsonified']) { |
|
| 2123 | $jsonPV = json_decode($data['form_jsonified']); |
|
| 2124 | foreach ($jsonPV as $element) { |
|
| 2125 | if ($element->form_properties) { |
|
| 2126 | $attributes = $element->form_properties[0]; |
|
| 2127 | $title = $attributes->title; |
|
| 2128 | $description = $attributes->description; |
|
| 2129 | ||
| 2130 | break; |
|
| 2131 | } |
|
| 2132 | } |
|
| 2133 | } |
|
| 2134 | if (! $form) { |
|
| 2135 | $form = new \PlaygroundGame\Entity\PlayerForm(); |
|
| 2136 | } |
|
| 2137 | $form->setGame($game); |
|
| 2138 | $form->setTitle($title); |
|
| 2139 | $form->setDescription($description); |
|
| 2140 | $form->setForm($data['form_jsonified']); |
|
| 2141 | $form->setFormTemplate($data['form_template']); |
|
| 2142 | ||
| 2143 | $form = $this->getPlayerFormMapper()->insert($form); |
|
| 2144 | ||
| 2145 | return $form; |
|
| 2146 | } |
|
| 2147 | ||
| 2148 | /** |
|
| 2149 | * getCSV creates lines of CSV and returns it. |
|