Code Duplication    Length = 21-21 lines in 2 locations

src/AppBundle/Controller/DeliveriesController.php 1 location

@@ 134-154 (lines=21) @@
131
     * @param \AppBundle\Entity\Inventory $orders Inventory item to print
132
     * @return \Symfony\Component\HttpFoundation\Response
133
     */
134
    public function printAction(Orders $orders)
135
    {
136
        $file = 'delivery-' . $orders->getId() . '.pdf';
137
        $company = $this->getDoctrine()->getManager()->getRepository('AppBundle:Company')->find(1);
138
        // Create and save the PDF file to print
139
        $html = $this->renderView(
140
            'AppBundle:Deliveries:print.pdf.twig',
141
            ['articles' => $orders->getArticles(), 'orders' => $orders, 'company' => $company, ]
142
        );
143
        return new Response(
144
            $this->get('knp_snappy.pdf')->getOutputFromHtml(
145
                $html,
146
                $this->getArray((string)date('d/m/y - H:i:s'), '')
147
            ),
148
            200,
149
            array(
150
                'Content-Type' => 'application/pdf',
151
                'Content-Disposition' => 'attachment; filename="' . $file . '"'
152
            )
153
        );
154
    }
155
156
    /**
157
     * Update Articles.

src/AppBundle/Controller/OrdersController.php 1 location

@@ 276-296 (lines=21) @@
273
     * @param \AppBundle\Entity\Inventory $orders Inventory item to print
274
     * @return \Symfony\Component\HttpFoundation\Response
275
     */
276
    public function printAction(Orders $orders)
277
    {
278
        $file = 'order-' . $orders->getId() . '.pdf';
279
        $company = $this->getDoctrine()->getManager()->getRepository('AppBundle:Company')->find(1);
280
        // Create and save the PDF file to print
281
        $html = $this->renderView(
282
            'AppBundle:Orders:print.pdf.twig',
283
            ['articles' => $orders->getArticles(), 'orders' => $orders, 'company' => $company, ]
284
        );
285
        return new Response(
286
            $this->get('knp_snappy.pdf')->getOutputFromHtml(
287
                $html,
288
                $this->getArray((string)date('d/m/y - H:i:s'), '')
289
            ),
290
            200,
291
            array(
292
                'Content-Type' => 'application/pdf',
293
                'Content-Disposition' => 'attachment; filename="' . $file . '"'
294
            )
295
        );
296
    }
297
}
298