Code Duplication    Length = 22-24 lines in 2 locations

Bundle/BusinessPageBundle/Controller/BusinessTemplateController.php 2 locations

@@ 179-202 (lines=24) @@
176
     *
177
     * @return JsonResponse The entity and the form
178
     */
179
    public function newAction($id)
180
    {
181
        //get the business entity
182
        $businessEntity = $this->getBusinessEntity($id);
183
184
        /** @var BusinessTemplate $view */
185
        $view = $this->get('victoire_business_page.BusinessTemplate_chain')->getBusinessTemplate($id);
186
        $view->setBusinessEntityId($businessEntity->getId());
187
188
        $form = $this->createCreateForm($view);
189
190
        $parameters = [
191
            'entity'             => $view,
192
            'form'               => $form->createView(),
193
        ];
194
195
        return new JsonResponse([
196
            'html' => $this->container->get('templating')->render(
197
                'VictoireBusinessPageBundle:BusinessTemplate:new.html.twig',
198
                $parameters
199
            ),
200
            'success' => true,
201
        ]);
202
    }
203
204
    /**
205
     * Displays a form to edit an existing BusinessTemplate entity.
@@ 216-237 (lines=22) @@
213
     *
214
     * @return JsonResponse The entity and the form
215
     */
216
    public function editAction(View $view)
217
    {
218
        $em = $this->getDoctrine()->getManager();
219
220
        $editForm = $this->createEditForm($view);
221
        $deleteForm = $this->createDeleteForm($view->getId());
222
223
224
        $parameters = [
225
            'entity'             => $view,
226
            'form'               => $editForm->createView(),
227
            'delete_form'        => $deleteForm->createView(),
228
        ];
229
230
        return new JsonResponse([
231
            'html' => $this->container->get('templating')->render(
232
                'VictoireBusinessPageBundle:BusinessTemplate:edit.html.twig',
233
                $parameters
234
            ),
235
            'success' => true,
236
        ]);
237
    }
238
239
    /**
240
     * Creates a form to edit a BusinessTemplate entity.