Code Duplication    Length = 21-22 lines in 2 locations

src/AppBundle/Controller/GroupController.php 1 location

@@ 157-178 (lines=22) @@
154
     * @param \Symfony\Component\HttpFoundation\Request $request Form request
155
     * @return array
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

@@ 184-204 (lines=21) @@
181
     * @param \Symfony\Component\HttpFoundation\Request $request   Form request
182
     * @return array
183
     */
184
    public function updateAction(Inventory $inventory, Request $request)
185
    {
186
        $editForm = $this->createForm(new InventoryEditType(), $inventory, array(
187
            'action' => $this->generateUrl('inventory_update', array('id' => $inventory->getId())),
188
            'method' => 'PUT',
189
        ));
190
        if ($editForm->handleRequest($request)->isValid()) {
191
            $inventory->setStatus('2');
192
            $this->getDoctrine()->getManager()->flush();
193
194
            return $this->redirectToRoute('inventory_edit', array('id' => $inventory->getId()));
195
        }
196
        $deleteForm = $this->createDeleteForm($inventory->getId(), 'inventory_delete');
197
198
199
        return array(
200
            'inventory' => $inventory,
201
            'edit_form'   => $editForm->createView(),
202
            'delete_form' => $deleteForm->createView(),
203
        );
204
    }
205
206
    /**
207
     * Displays a form to valid an existing Inventory entity.