| @@ 108-116 (lines=9) @@ | ||
| 105 | $form = $this->container->get('form.factory')->create($this->getNewTemplateType(), $template); //@todo utiliser un service |
|
| 106 | ||
| 107 | $form->handleRequest($this->get('request')); |
|
| 108 | if ($form->isValid()) { |
|
| 109 | $em->persist($template); |
|
| 110 | $em->flush(); |
|
| 111 | ||
| 112 | return new JsonResponse([ |
|
| 113 | 'success' => true, |
|
| 114 | 'url' => $this->generateUrl('victoire_template_show', ['slug' => $template->getSlug()]), |
|
| 115 | ]); |
|
| 116 | } |
|
| 117 | ||
| 118 | return new JsonResponse( |
|
| 119 | [ |
|
| @@ 144-154 (lines=11) @@ | ||
| 141 | ||
| 142 | $form = $this->createForm($this->getNewTemplateType(), $template); |
|
| 143 | $form->handleRequest($request); |
|
| 144 | if ($form->isValid()) { |
|
| 145 | $em->persist($template); |
|
| 146 | $em->flush(); |
|
| 147 | ||
| 148 | return new JsonResponse( |
|
| 149 | [ |
|
| 150 | 'success' => true, |
|
| 151 | 'url' => $this->generateUrl('victoire_template_show', ['slug' => $template->getSlug()]), |
|
| 152 | ] |
|
| 153 | ); |
|
| 154 | } |
|
| 155 | ||
| 156 | return new JsonResponse( |
|
| 157 | [ |
|