| @@ 272-301 (lines=30) @@ | ||
| 269 | * @param array $data |
|
| 270 | * @return \PlaygroundGame\Entity\Game |
|
| 271 | */ |
|
| 272 | public function createForm(array $data, $game, $form = null) |
|
| 273 | { |
|
| 274 | $title =''; |
|
| 275 | $description = ''; |
|
| 276 | ||
| 277 | if ($data['form_jsonified']) { |
|
| 278 | $jsonPV = json_decode($data['form_jsonified']); |
|
| 279 | foreach ($jsonPV as $element) { |
|
| 280 | if ($element->form_properties) { |
|
| 281 | $attributes = $element->form_properties[0]; |
|
| 282 | $title = $attributes->title; |
|
| 283 | $description = $attributes->description; |
|
| 284 | ||
| 285 | break; |
|
| 286 | } |
|
| 287 | } |
|
| 288 | } |
|
| 289 | if (!$form) { |
|
| 290 | $form = new \PlaygroundGame\Entity\PostVoteForm(); |
|
| 291 | } |
|
| 292 | $form->setPostvote($game); |
|
| 293 | $form->setTitle($title); |
|
| 294 | $form->setDescription($description); |
|
| 295 | $form->setForm($data['form_jsonified']); |
|
| 296 | $form->setFormTemplate($data['form_template']); |
|
| 297 | ||
| 298 | $form = $this->getPostVoteFormMapper()->insert($form); |
|
| 299 | ||
| 300 | return $form; |
|
| 301 | } |
|
| 302 | ||
| 303 | public function findArrayOfValidatedPosts($game, $user, $filter, $search = '') |
|
| 304 | { |
|
| @@ 1888-1917 (lines=30) @@ | ||
| 1885 | * @param array $data |
|
| 1886 | * @return \PlaygroundGame\Entity\Game |
|
| 1887 | */ |
|
| 1888 | public function createForm(array $data, $game, $form = null) |
|
| 1889 | { |
|
| 1890 | $title = ''; |
|
| 1891 | $description = ''; |
|
| 1892 | ||
| 1893 | if ($data['form_jsonified']) { |
|
| 1894 | $jsonPV = json_decode($data['form_jsonified']); |
|
| 1895 | foreach ($jsonPV as $element) { |
|
| 1896 | if ($element->form_properties) { |
|
| 1897 | $attributes = $element->form_properties[0]; |
|
| 1898 | $title = $attributes->title; |
|
| 1899 | $description = $attributes->description; |
|
| 1900 | ||
| 1901 | break; |
|
| 1902 | } |
|
| 1903 | } |
|
| 1904 | } |
|
| 1905 | if (! $form) { |
|
| 1906 | $form = new \PlaygroundGame\Entity\PlayerForm(); |
|
| 1907 | } |
|
| 1908 | $form->setGame($game); |
|
| 1909 | $form->setTitle($title); |
|
| 1910 | $form->setDescription($description); |
|
| 1911 | $form->setForm($data['form_jsonified']); |
|
| 1912 | $form->setFormTemplate($data['form_template']); |
|
| 1913 | ||
| 1914 | $form = $this->getPlayerFormMapper()->insert($form); |
|
| 1915 | ||
| 1916 | return $form; |
|
| 1917 | } |
|
| 1918 | ||
| 1919 | /** |
|
| 1920 | * getCSV creates lines of CSV and returns it. |
|