| @@ 259-288 (lines=30) @@ | ||
| 256 | * @param array $data |
|
| 257 | * @return \PlaygroundGame\Entity\Game |
|
| 258 | */ |
|
| 259 | public function createForm(array $data, $game, $form = null) |
|
| 260 | { |
|
| 261 | $title =''; |
|
| 262 | $description = ''; |
|
| 263 | ||
| 264 | if ($data['form_jsonified']) { |
|
| 265 | $jsonPV = json_decode($data['form_jsonified']); |
|
| 266 | foreach ($jsonPV as $element) { |
|
| 267 | if ($element->form_properties) { |
|
| 268 | $attributes = $element->form_properties[0]; |
|
| 269 | $title = $attributes->title; |
|
| 270 | $description = $attributes->description; |
|
| 271 | ||
| 272 | break; |
|
| 273 | } |
|
| 274 | } |
|
| 275 | } |
|
| 276 | if (!$form) { |
|
| 277 | $form = new \PlaygroundGame\Entity\PostVoteForm(); |
|
| 278 | } |
|
| 279 | $form->setPostvote($game); |
|
| 280 | $form->setTitle($title); |
|
| 281 | $form->setDescription($description); |
|
| 282 | $form->setForm($data['form_jsonified']); |
|
| 283 | $form->setFormTemplate($data['form_template']); |
|
| 284 | ||
| 285 | $form = $this->getPostVoteFormMapper()->insert($form); |
|
| 286 | ||
| 287 | return $form; |
|
| 288 | } |
|
| 289 | ||
| 290 | public function findArrayOfValidatedPosts($game, $user, $filter, $search = '') |
|
| 291 | { |
|
| @@ 1735-1764 (lines=30) @@ | ||
| 1732 | * @param array $data |
|
| 1733 | * @return \PlaygroundGame\Entity\Game |
|
| 1734 | */ |
|
| 1735 | public function createForm(array $data, $game, $form = null) |
|
| 1736 | { |
|
| 1737 | $title = ''; |
|
| 1738 | $description = ''; |
|
| 1739 | ||
| 1740 | if ($data['form_jsonified']) { |
|
| 1741 | $jsonPV = json_decode($data['form_jsonified']); |
|
| 1742 | foreach ($jsonPV as $element) { |
|
| 1743 | if ($element->form_properties) { |
|
| 1744 | $attributes = $element->form_properties[0]; |
|
| 1745 | $title = $attributes->title; |
|
| 1746 | $description = $attributes->description; |
|
| 1747 | ||
| 1748 | break; |
|
| 1749 | } |
|
| 1750 | } |
|
| 1751 | } |
|
| 1752 | if (! $form) { |
|
| 1753 | $form = new \PlaygroundGame\Entity\PlayerForm(); |
|
| 1754 | } |
|
| 1755 | $form->setGame($game); |
|
| 1756 | $form->setTitle($title); |
|
| 1757 | $form->setDescription($description); |
|
| 1758 | $form->setForm($data['form_jsonified']); |
|
| 1759 | $form->setFormTemplate($data['form_template']); |
|
| 1760 | ||
| 1761 | $form = $this->getPlayerFormMapper()->insert($form); |
|
| 1762 | ||
| 1763 | return $form; |
|
| 1764 | } |
|
| 1765 | ||
| 1766 | /** |
|
| 1767 | * getCSV creates lines of CSV and returns it. |
|