|
@@ 133-146 (lines=14) @@
|
| 130 |
|
|
| 131 |
|
$errors = $this->get('validator')->validate($pendingCompletion); |
| 132 |
|
|
| 133 |
|
if (0 === count($errors)) { |
| 134 |
|
$this->get('badger.game.saver.badge_completion')->save($pendingCompletion); |
| 135 |
|
|
| 136 |
|
$event = new BadgeUnlockEvent($pendingCompletion); |
| 137 |
|
$this->get('event_dispatcher')->dispatch(GameEvents::USER_UNLOCKED_BADGE, $event); |
| 138 |
|
|
| 139 |
|
$this->addFlash('notice', sprintf( |
| 140 |
|
'%s successfully unlocked the badge "%s"!', |
| 141 |
|
$user->getUsername(), |
| 142 |
|
$badge->getTitle() |
| 143 |
|
)); |
| 144 |
|
} else { |
| 145 |
|
$this->addFlash('error', (string) $errors); |
| 146 |
|
} |
| 147 |
|
|
| 148 |
|
return $this->redirectToRoute('admin_claimed_badge_index'); |
| 149 |
|
} |
|
@@ 204-217 (lines=14) @@
|
| 201 |
|
|
| 202 |
|
$errors = $validator->validate($badgeCompletion); |
| 203 |
|
|
| 204 |
|
if (0 === count($errors)) { |
| 205 |
|
$this->get('badger.game.saver.badge_completion')->save($badgeCompletion); |
| 206 |
|
|
| 207 |
|
$event = new BadgeUnlockEvent($badgeCompletion); |
| 208 |
|
$this->get('event_dispatcher')->dispatch(GameEvents::USER_UNLOCKED_BADGE, $event); |
| 209 |
|
|
| 210 |
|
$this->addFlash('notice', sprintf( |
| 211 |
|
'%s successfully received the badge "%s"!', |
| 212 |
|
$user->getUsername(), |
| 213 |
|
$badge->getTitle() |
| 214 |
|
)); |
| 215 |
|
} else { |
| 216 |
|
$this->addFlash('error', (string) $errors); |
| 217 |
|
} |
| 218 |
|
} |
| 219 |
|
|
| 220 |
|
$badges = $badgeRepository->findAll(); |