Test game
This commit is contained in:
parent
a7f0415eb4
commit
2ded8129b1
2 changed files with 17 additions and 2 deletions
|
@ -43,10 +43,20 @@ class ScoreControllerProvider implements ControllerProviderInterface
|
|||
return $app['serializer']->serialize($user, 'json');
|
||||
});
|
||||
|
||||
$controllers->get('/games/{gameId}', function(Request $request, Application $app) {
|
||||
|
||||
$game = $request->attributes->get('game');
|
||||
|
||||
return $app['serializer']->serialize($game, 'json');
|
||||
|
||||
})
|
||||
->bind('game')
|
||||
->convert('game', function($game, Request $request) use ($app){ return $app['entity.manager']->getRepository(Models\Game::class)->find($request->attributes->get('gameId'));});
|
||||
|
||||
/**
|
||||
* Expects a full game + hits in the request
|
||||
*/
|
||||
$controllers->post('/me/games', function (Request $request, Application $app) {
|
||||
$controllers->post('/games', function (Request $request, Application $app) {
|
||||
$data = json_decode($request->getContent(), true);
|
||||
$token = $app['security.token_storage']->getToken();
|
||||
$user = $token->getUser();
|
||||
|
|
|
@ -19,6 +19,11 @@ $app = new Silex\Application([
|
|||
define('USER_ID_FIELD', 'id');
|
||||
|
||||
|
||||
$app['entity.manager'] = function() {
|
||||
return EmotionHero\Application::getInstance()->getEm();
|
||||
};
|
||||
|
||||
|
||||
|
||||
$app['security.jwt'] = [
|
||||
'secret_key' => $eh->getConfig()['secret_key'],
|
||||
|
|
Loading…
Reference in a new issue