| @@ 1716-1745 (lines=30) @@ | ||
| 1713 | * @param array $data |
|
| 1714 | * @return \PlaygroundGame\Entity\Game |
|
| 1715 | */ |
|
| 1716 | public function createForm(array $data, $game, $form = null) |
|
| 1717 | { |
|
| 1718 | $title = ''; |
|
| 1719 | $description = ''; |
|
| 1720 | ||
| 1721 | if ($data['form_jsonified']) { |
|
| 1722 | $jsonPV = json_decode($data['form_jsonified']); |
|
| 1723 | foreach ($jsonPV as $element) { |
|
| 1724 | if ($element->form_properties) { |
|
| 1725 | $attributes = $element->form_properties[0]; |
|
| 1726 | $title = $attributes->title; |
|
| 1727 | $description = $attributes->description; |
|
| 1728 | ||
| 1729 | break; |
|
| 1730 | } |
|
| 1731 | } |
|
| 1732 | } |
|
| 1733 | if (! $form) { |
|
| 1734 | $form = new \PlaygroundGame\Entity\PlayerForm(); |
|
| 1735 | } |
|
| 1736 | $form->setGame($game); |
|
| 1737 | $form->setTitle($title); |
|
| 1738 | $form->setDescription($description); |
|
| 1739 | $form->setForm($data['form_jsonified']); |
|
| 1740 | $form->setFormTemplate($data['form_template']); |
|
| 1741 | ||
| 1742 | $form = $this->getPlayerFormMapper()->insert($form); |
|
| 1743 | ||
| 1744 | return $form; |
|
| 1745 | } |
|
| 1746 | ||
| 1747 | /** |
|
| 1748 | * getCSV creates lines of CSV and returns it. |
|
| @@ 258-287 (lines=30) @@ | ||
| 255 | * @param array $data |
|
| 256 | * @return \PlaygroundGame\Entity\Game |
|
| 257 | */ |
|
| 258 | public function createForm(array $data, $game, $form = null) |
|
| 259 | { |
|
| 260 | $title =''; |
|
| 261 | $description = ''; |
|
| 262 | ||
| 263 | if ($data['form_jsonified']) { |
|
| 264 | $jsonPV = json_decode($data['form_jsonified']); |
|
| 265 | foreach ($jsonPV as $element) { |
|
| 266 | if ($element->form_properties) { |
|
| 267 | $attributes = $element->form_properties[0]; |
|
| 268 | $title = $attributes->title; |
|
| 269 | $description = $attributes->description; |
|
| 270 | ||
| 271 | break; |
|
| 272 | } |
|
| 273 | } |
|
| 274 | } |
|
| 275 | if (!$form) { |
|
| 276 | $form = new \PlaygroundGame\Entity\PostVoteForm(); |
|
| 277 | } |
|
| 278 | $form->setPostvote($game); |
|
| 279 | $form->setTitle($title); |
|
| 280 | $form->setDescription($description); |
|
| 281 | $form->setForm($data['form_jsonified']); |
|
| 282 | $form->setFormTemplate($data['form_template']); |
|
| 283 | ||
| 284 | $form = $this->getPostVoteFormMapper()->insert($form); |
|
| 285 | ||
| 286 | return $form; |
|
| 287 | } |
|
| 288 | ||
| 289 | public function findArrayOfValidatedPosts($game, $user, $filter, $search = '') |
|
| 290 | { |
|