| @@ 279-299 (lines=21) @@ | ||
| 276 | return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/instantwin-occurrence-list', array('gameId'=>$this->game->getId()))); |
|
| 277 | } |
|
| 278 | ||
| 279 | public function removeOccurrenceAction() |
|
| 280 | { |
|
| 281 | $service = $this->getAdminGameService(); |
|
| 282 | $occurrenceId = $this->getEvent()->getRouteMatch()->getParam('occurrenceId'); |
|
| 283 | if (!$occurrenceId) { |
|
| 284 | return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/list')); |
|
| 285 | } |
|
| 286 | $occurrence = $service->getInstantWinOccurrenceMapper()->findById($occurrenceId); |
|
| 287 | $instantwinId = $occurrence->getInstantWin()->getId(); |
|
| 288 | ||
| 289 | if ($occurrence->getActive()) { |
|
| 290 | $service->getInstantWinOccurrenceMapper()->remove($occurrence); |
|
| 291 | $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The occurrence has been deleted'); |
|
| 292 | } else { |
|
| 293 | $this->flashMessenger()->setNamespace('playgroundgame')->addMessage( |
|
| 294 | "A player has already won this occurrence. You can't delete it anymore" |
|
| 295 | ); |
|
| 296 | } |
|
| 297 | ||
| 298 | return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/instantwin-occurrence-list', array('gameId'=>$instantwinId))); |
|
| 299 | } |
|
| 300 | ||
| 301 | public function exportOccurrencesAction() |
|
| 302 | { |
|
| @@ 250-270 (lines=21) @@ | ||
| 247 | ); |
|
| 248 | } |
|
| 249 | ||
| 250 | public function removeModelAction() |
|
| 251 | { |
|
| 252 | $service = $this->getAdminGameService(); |
|
| 253 | $modelId = $this->getEvent()->getRouteMatch()->getParam('modelId'); |
|
| 254 | if (!$modelId) { |
|
| 255 | return $this->redirect()->toUrl($this->adminUrl()->fromRoute('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()->toUrl($this->adminUrl()->fromRoute('playgroundgame/tradingcard-model-list', array('gameId' => $tradingcardId))); |
|
| 270 | } |
|
| 271 | ||
| 272 | public function getAdminGameService() |
|
| 273 | { |
|