Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
nilportugues committed Sep 8, 2015
1 parent b98c6a8 commit 12cc826
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,23 +212,33 @@ class UserController extends \App\Http\Controllers\Controller
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function getUserAction($id)
public function getOneUserAction($id)
{
$user = $this->userRepository->find($id);

/** @var \NilPortugues\Api\JsonApi\JsonApiTransformer $transformer */
$transformer = $this->serializer->getTransformer();
$transformer->setSelfUrl(route('get_user', ['id' => $postId]));
$transformer->setNextUrl(route('get_user', ['id' => $postId+1]));
$transformer->setSelfUrl(route('get_user', ['id' => $id]));
$transformer->setNextUrl(route('get_user', ['id' => $id+1]));

return $this->response($this->serializer->serialize($user));
}

/**
* @return \Symfony\Component\HttpFoundation\Response
*/
public function getAllUsersAction()
{
return $this->response($this->serializer->serialize($this->userRepository->all()));
}
}
```


**Output:**

This is the output for `UserController@getAllUsersAction` method:

```
HTTP/1.1 200 OK
Cache-Control: private, max-age=0, must-revalidate
Expand Down

0 comments on commit 12cc826

Please sign in to comment.