Code Duplication    Length = 24-24 lines in 2 locations

src/PlaygroundGame/Controller/Admin/InstantWinController.php 1 location

@@ 282-305 (lines=24) @@
279
    }
280
281
282
    public function removeOccurrenceAction()
283
    {
284
        $service = $this->getAdminGameService();
285
        $occurrenceId = $this->getEvent()->getRouteMatch()->getParam('occurrenceId');
286
        if (!$occurrenceId) {
287
            return $this->redirect()->toRoute('admin/playgroundgame/list');
288
        }
289
        $occurrence   = $service->getInstantWinOccurrenceMapper()->findById($occurrenceId);
290
        $instantwinId = $occurrence->getInstantWin()->getId();
291
292
        if ($occurrence->getActive()) {
293
            $service->getInstantWinOccurrenceMapper()->remove($occurrence);
294
            $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The occurrence was deleted');
295
        } else {
296
            $this->flashMessenger()->setNamespace('playgroundgame')->addMessage(
297
                'Il y a un participant à cet instant gagnant. Vous ne pouvez plus le supprimer'
298
            );
299
        }
300
301
        return $this->redirect()->toRoute(
302
            'admin/playgroundgame/instantwin-occurrence-list',
303
            array('gameId'=>$instantwinId)
304
        );
305
    }
306
307
    public function exportOccurrencesAction()
308
    {

src/PlaygroundGame/Controller/Admin/TradingCardController.php 1 location

@@ 250-273 (lines=24) @@
247
        );
248
    }
249
250
    public function removeOccurrenceAction()
251
    {
252
        $service = $this->getAdminGameService();
253
        $modelId = $this->getEvent()->getRouteMatch()->getParam('modelId');
254
        if (!$modelId) {
255
            return $this->redirect()->toRoute('admin/playgroundgame/list');
256
        }
257
        $model         = $service->getTradingCardModelMapper()->findById($modelId);
258
        $tradingcardId = $model->getTradingCard()->getId();
259
260
        if ($model->getActive()) {
261
            $service->getTradingCardModelMapper()->remove($model);
262
            $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The model has been deleted');
263
        } else {
264
            $this->flashMessenger()->setNamespace('playgroundgame')->addMessage(
265
                'cards have already been created with this model'
266
            );
267
        }
268
269
        return $this->redirect()->toRoute(
270
            'admin/playgroundgame/tradingcard-model-list',
271
            array('gameId' => $tradingcardId)
272
        );
273
    }
274
275
    public function getAdminGameService()
276
    {