Code Duplication    Length = 20-20 lines in 2 locations

src/AppBundle/Controller/HistoryController.php 1 location

@@ 161-180 (lines=20) @@
158
     *
159
     * @RestView
160
     */
161
    public function getAction(ParamFetcher $paramFetcher, $slug)
162
    {
163
        $em = $this->getDoctrine()->getManager();
164
165
        $history = $em
166
            ->getRepository('AppBundle:History')->findOneByslug($slug);
167
168
        if (!$history) {
169
            throw $this->createNotFoundException('Unable to find '.$slug.' entity');
170
        }
171
172
        $history->setLocale($paramFetcher->get('locale'));
173
        $em->refresh($history);
174
175
        if ($history->getTranslations()) {
176
            $history->unsetTranslations();
177
        }
178
179
        return $history;
180
    }
181
}
182

src/AppBundle/Controller/PerformancesController.php 1 location

@@ 191-210 (lines=20) @@
188
     *
189
     * @RestView
190
     */
191
    public function getAction(ParamFetcher $paramFetcher, $slug)
192
    {
193
        $em = $this->getDoctrine()->getManager();
194
195
        $performance = $em
196
            ->getRepository('AppBundle:Performance')->findOneByslug($slug);
197
198
        if (!$performance) {
199
            throw $this->createNotFoundException('Unable to find '.$slug.' entity');
200
        }
201
202
        $performance->setLocale($paramFetcher->get('locale'));
203
        $em->refresh($performance);
204
205
        if ($performance->getTranslations()) {
206
            $performance->unsetTranslations();
207
        }
208
209
        return $performance;
210
    }
211
212
    /**
213
     * @ApiDoc(