|
@@ 93-106 (lines=14) @@
|
| 90 |
|
|
| 91 |
|
$errors = $this->get('validator')->validate($pendingCompletion); |
| 92 |
|
|
| 93 |
|
if (0 === count($errors)) { |
| 94 |
|
$this->get('badger.game.saver.badge_completion')->save($pendingCompletion); |
| 95 |
|
|
| 96 |
|
$event = new BadgeUnlockEvent($pendingCompletion); |
| 97 |
|
$this->get('event_dispatcher')->dispatch(GameEvents::USER_UNLOCKED_BADGE, $event); |
| 98 |
|
|
| 99 |
|
$this->addFlash('notice', sprintf( |
| 100 |
|
'%s successfully unlocked the badge "%s"!', |
| 101 |
|
$user->getUsername(), |
| 102 |
|
$badge->getTitle() |
| 103 |
|
)); |
| 104 |
|
} else { |
| 105 |
|
$this->addFlash('error', (string) $errors); |
| 106 |
|
} |
| 107 |
|
|
| 108 |
|
return $this->redirectToRoute('admin_claimed_badge_index'); |
| 109 |
|
} |
|
@@ 164-177 (lines=14) @@
|
| 161 |
|
|
| 162 |
|
$errors = $validator->validate($badgeCompletion); |
| 163 |
|
|
| 164 |
|
if (0 === count($errors)) { |
| 165 |
|
$this->get('badger.game.saver.badge_completion')->save($badgeCompletion); |
| 166 |
|
|
| 167 |
|
$event = new BadgeUnlockEvent($badgeCompletion); |
| 168 |
|
$this->get('event_dispatcher')->dispatch(GameEvents::USER_UNLOCKED_BADGE, $event); |
| 169 |
|
|
| 170 |
|
$this->addFlash('notice', sprintf( |
| 171 |
|
'%s successfully received the badge "%s"!', |
| 172 |
|
$user->getUsername(), |
| 173 |
|
$badge->getTitle() |
| 174 |
|
)); |
| 175 |
|
} else { |
| 176 |
|
$this->addFlash('error', (string) $errors); |
| 177 |
|
} |
| 178 |
|
} |
| 179 |
|
|
| 180 |
|
$badges = $badgeRepository->findAll(); |