Code Duplication    Length = 21-22 lines in 2 locations

src/AppBundle/Controller/GroupController.php 1 location

@@ 157-178 (lines=22) @@
154
     * @Method("PUT")
155
     * @Template("AppBundle:Group:edit.html.twig")
156
     */
157
    public function updateAction(Group $group, Request $request)
158
    {
159
        $editForm = $this->createForm(new GroupType(), $group, array(
160
            'action' => $this->generateUrl('group_update', array('id' => $group->getId())),
161
            'method' => 'PUT',
162
        ));
163
        $this->addRoles($editForm, $group);
164
165
        if ($editForm->handleRequest($request)->isValid()) {
166
            $this->getDoctrine()->getManager()->flush();
167
            $this->addFlash('info', 'gestock.edit.ok');
168
169
            return $this->redirectToRoute('group_edit', array('id' => $group->getId()));
170
        }
171
        $deleteForm = $this->createDeleteForm($group->getId(), 'group_delete');
172
173
        return array(
174
            'group' => $group,
175
            'edit_form'   => $editForm->createView(),
176
            'delete_form' => $deleteForm->createView(),
177
        );
178
    }
179
180
    /**
181
     * Deletes a Group entity.

src/AppBundle/Controller/InventoryController.php 1 location

@@ 175-195 (lines=21) @@
172
     * @Method("PUT")
173
     * @Template("AppBundle:Inventory:edit.html.twig")
174
     */
175
    public function updateAction(Inventory $inventory, Request $request)
176
    {
177
        $editForm = $this->createForm(new InventoryEditType(), $inventory, array(
178
            'action' => $this->generateUrl('inventory_update', array('id' => $inventory->getId())),
179
            'method' => 'PUT',
180
        ));
181
        if ($editForm->handleRequest($request)->isValid()) {
182
            $inventory->setStatus('2');
183
            $this->getDoctrine()->getManager()->flush();
184
185
            return $this->redirectToRoute('inventory_edit', array('id' => $inventory->getId()));
186
        }
187
        $deleteForm = $this->createDeleteForm($inventory->getId(), 'inventory_delete');
188
189
190
        return array(
191
            'inventory' => $inventory,
192
            'edit_form'   => $editForm->createView(),
193
            'delete_form' => $deleteForm->createView(),
194
        );
195
    }
196
197
    /**
198
     * Displays a form to valid an existing Inventory entity.