Ejemplo n.º 1
0
 public function createUser(Request $request)
 {
     $newUser = json_decode($request->getContent(), true);
     $user = $this->app['users.repository']->create($newUser);
     $url = $this->app['url_generator']->generate('users.view', ['user' => $user['username']]);
     return $this->app->redirect($url, Response::HTTP_CREATED);
 }
Ejemplo n.º 2
0
 public function reply($message, Request $request)
 {
     $newMessage = json_decode($request->getContent(), true);
     $newMessage['parent'] = $message['id'];
     $message = $this->app['messages.repository']->create($newMessage);
     $url = $this->app['url_generator']->generate('messages.view', ['message' => $message['id']]);
     return $this->app->redirect($url, Response::HTTP_CREATED);
 }