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