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

@@ 199-222 (lines=24) @@
196
    }
197
198
199
    public function removeOccurrenceAction()
200
    {
201
        $service = $this->getAdminGameService();
202
        $modelId = $this->getEvent()->getRouteMatch()->getParam('modelId');
203
        if (!$modelId) {
204
            return $this->redirect()->toRoute('admin/playgroundgame/list');
205
        }
206
        $model   = $service->getTradingCardModelMapper()->findById($modelId);
207
        $tradingcardId = $model->getTradingCard()->getId();
208
209
        if ($model->getActive()) {
210
            $service->getTradingCardModelMapper()->remove($model);
211
            $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The model has been deleted');
212
        } else {
213
            $this->flashMessenger()->setNamespace('playgroundgame')->addMessage(
214
                'cards have already been created with this model'
215
            );
216
        }
217
218
        return $this->redirect()->toRoute(
219
            'admin/playgroundgame/tradingcard-model-list',
220
            array('gameId'=>$tradingcardId)
221
        );
222
    }
223
224
    public function getAdminGameService()
225
    {