| @@ 263-292 (lines=30) @@ | ||
| 260 | * @param array $data |
|
| 261 | * @return \PlaygroundGame\Entity\Game |
|
| 262 | */ |
|
| 263 | public function createForm(array $data, $game, $form = null) |
|
| 264 | { |
|
| 265 | $title =''; |
|
| 266 | $description = ''; |
|
| 267 | ||
| 268 | if ($data['form_jsonified']) { |
|
| 269 | $jsonPV = json_decode($data['form_jsonified']); |
|
| 270 | foreach ($jsonPV as $element) { |
|
| 271 | if ($element->form_properties) { |
|
| 272 | $attributes = $element->form_properties[0]; |
|
| 273 | $title = $attributes->title; |
|
| 274 | $description = $attributes->description; |
|
| 275 | ||
| 276 | break; |
|
| 277 | } |
|
| 278 | } |
|
| 279 | } |
|
| 280 | if (!$form) { |
|
| 281 | $form = new \PlaygroundGame\Entity\PostVoteForm(); |
|
| 282 | } |
|
| 283 | $form->setPostvote($game); |
|
| 284 | $form->setTitle($title); |
|
| 285 | $form->setDescription($description); |
|
| 286 | $form->setForm($data['form_jsonified']); |
|
| 287 | $form->setFormTemplate($data['form_template']); |
|
| 288 | ||
| 289 | $form = $this->getPostVoteFormMapper()->insert($form); |
|
| 290 | ||
| 291 | return $form; |
|
| 292 | } |
|
| 293 | ||
| 294 | public function findArrayOfValidatedPosts($game, $user, $filter, $search = '') |
|
| 295 | { |
|
| @@ 1748-1777 (lines=30) @@ | ||
| 1745 | * @param array $data |
|
| 1746 | * @return \PlaygroundGame\Entity\Game |
|
| 1747 | */ |
|
| 1748 | public function createForm(array $data, $game, $form = null) |
|
| 1749 | { |
|
| 1750 | $title = ''; |
|
| 1751 | $description = ''; |
|
| 1752 | ||
| 1753 | if ($data['form_jsonified']) { |
|
| 1754 | $jsonPV = json_decode($data['form_jsonified']); |
|
| 1755 | foreach ($jsonPV as $element) { |
|
| 1756 | if ($element->form_properties) { |
|
| 1757 | $attributes = $element->form_properties[0]; |
|
| 1758 | $title = $attributes->title; |
|
| 1759 | $description = $attributes->description; |
|
| 1760 | ||
| 1761 | break; |
|
| 1762 | } |
|
| 1763 | } |
|
| 1764 | } |
|
| 1765 | if (! $form) { |
|
| 1766 | $form = new \PlaygroundGame\Entity\PlayerForm(); |
|
| 1767 | } |
|
| 1768 | $form->setGame($game); |
|
| 1769 | $form->setTitle($title); |
|
| 1770 | $form->setDescription($description); |
|
| 1771 | $form->setForm($data['form_jsonified']); |
|
| 1772 | $form->setFormTemplate($data['form_template']); |
|
| 1773 | ||
| 1774 | $form = $this->getPlayerFormMapper()->insert($form); |
|
| 1775 | ||
| 1776 | return $form; |
|
| 1777 | } |
|
| 1778 | ||
| 1779 | /** |
|
| 1780 | * getCSV creates lines of CSV and returns it. |
|