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