Code Duplication    Length = 27-27 lines in 2 locations

src/AppBundle/Controller/DeliveriesController.php 1 location

@@ 95-121 (lines=27) @@
92
     * @Method("PUT")
93
     * @Template("AppBundle:Deliveries:edit.html.twig")
94
     */
95
    public function updateAction(Orders $orders, Request $request)
96
    {
97
        $etm = $this->getDoctrine()->getManager();
98
99
        $editForm = $this->createForm(OrdersEditType::class, $orders, array(
100
            'action' => $this->generateUrl('deliveries_update', array('id' => $orders->getId())),
101
            'method' => 'PUT',
102
        ));
103
        $editForm->handleRequest($request);
104
105
        $return = array(
106
            'orders' => $orders,
107
            'edit_form'   => $editForm->createView(),
108
        );
109
        
110
        if ($editForm->isValid()) {
111
            $orders->setStatus(2);
112
            $etm->persist($orders);
113
            $this->updateArticles($orders, $etm);
114
            $this->addFlash('info', 'gestock.edit.ok');
115
            $etm->flush();
116
117
            $return = $this->redirect($this->generateUrl('_home'));
118
        }
119
120
        return $return;
121
    }
122
123
    /**
124
     * Print the current delivery.<br />Creating a `PDF` file for viewing on paper

src/AppBundle/Controller/InvoicesController.php 1 location

@@ 93-119 (lines=27) @@
90
     * @Method("PUT")
91
     * @Template("AppBundle:Deliveries:edit.html.twig")
92
     */
93
    public function updateAction(Orders $orders, Request $request)
94
    {
95
        $etm = $this->getDoctrine()->getManager();
96
97
        $editForm = $this->createForm(InvoicesEditType::class, $orders, array(
98
            'action' => $this->generateUrl('invoices_update', array('id' => $orders->getId())),
99
            'method' => 'PUT',
100
        ));
101
        $editForm->handleRequest($request);
102
103
        $return = array(
104
            'orders' => $orders,
105
            'edit_form'   => $editForm->createView(),
106
        );
107
        
108
        if ($editForm->isValid()) {
109
            $orders->setStatus(3);
110
            $etm->persist($orders);
111
            $this->updateArticles($orders, $etm);
112
            $this->addFlash('info', 'gestock.edit.ok');
113
            $etm->flush();
114
115
            $return = $this->redirect($this->generateUrl('_home'));
116
        }
117
118
        return $return;
119
    }
120
121
    /**
122
     * Print the current invoice.<br />Creating a `PDF` file for viewing on paper