Code Duplication    Length = 15-20 lines in 2 locations

src/ApiBundle/Controller/BeerController.php 2 locations

@@ 66-85 (lines=20) @@
63
     * @param UUID $breweryId Brewery Id
64
     * @param UUID $beerId    Beer Id
65
     */
66
    public function getAction($breweryId, $beerId)
67
    {
68
        $brewery = $this->getDoctrine()->getManager()
69
                        ->getRepository('MaxpouBeerBundle:Brewery')
70
                        ->find($breweryId);
71
72
        if (!$brewery) {
73
            throw new HttpException(404, 'Unable to find this Brewery entity');
74
        }
75
76
        $beer = $this->getDoctrine()->getManager()
77
                        ->getRepository('MaxpouBeerBundle:Beer')
78
                        ->find($beerId);
79
80
        if (!$beer) {
81
            throw new HttpException(404, 'Unable to find this Beer entity');
82
        }
83
84
        return $beer;
85
    }
86
87
    /**
88
     * Add a Beer.
@@ 213-227 (lines=15) @@
210
     *
211
     * @param UUID $breweryId Brewery Id
212
     */
213
    public function cdeleteAction($breweryId)
214
    {
215
        $em = $this->getDoctrine()->getManager();
216
        $brewery = $em->getRepository('MaxpouBeerBundle:Brewery')
217
                      ->find($breweryId);
218
219
        if (!$brewery) {
220
            throw new HttpException(404, 'Unable to find this Brewery entity');
221
        }
222
223
        $em->getRepository('MaxpouBeerBundle:Beer')
224
           ->deleteAll($brewery);
225
226
        return $this->view(null, 204);
227
    }
228
229
    /**
230
     * Options.