Skip to content

Commit

Permalink
Update Resources/doc/5-automatic-route-generation_single-restful-cont…
Browse files Browse the repository at this point in the history
…roller.md
  • Loading branch information
OwlyCode committed Dec 8, 2012
1 parent 0326ff4 commit 2d4467d
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ class UsersController


public function deleteUserCommentAction($slug, $id) public function deleteUserCommentAction($slug, $id)
{} // "delete_user_comment" [DELETE] /users/{slug}/comments/{id} {} // "delete_user_comment" [DELETE] /users/{slug}/comments/{id}

public function linkUserAction($slug)
{} // "link_user_friend" [LINK] /users/{slug}/friend

public function unlinkUserAction($slug)
{} // "link_user_friend" [UNLINK] /users/{slug}/friend
} }
``` ```


Expand Down Expand Up @@ -199,6 +205,18 @@ This action also accepts *PATCH* requests to the url */resources/{id}* and is su
Shown as ``UsersController::patchUserAction()`` above. Shown as ``UsersController::patchUserAction()`` above.
* **option** - this action accepts *OPTION* requests to the url */resources* and is supposed to return a list of REST * **option** - this action accepts *OPTION* requests to the url */resources* and is supposed to return a list of REST
resources that the user has access to. Shown as ``UsersController::userAction()`` above. resources that the user has access to. Shown as ``UsersController::userAction()`` above.
* **link** - this action accepts *LINK* requests to the url */resources/{id}* and is supposed to return nothing but a
status code indicating that the specified resources were linked. It is used to declare a resource as related to an other one.
When calling a LINK url you must provide in your header at least one link header formatted as follow :
``<http://example.com/resources/{id}\>; rel="kind_of_relation"``
* **unlink** - this action accepts *UNLINK* requests to the url */resources/{id}* and is supposed to return nothing but
a status code indicating that the specified resources were unlinked. It is used to declare that some resources are not
related anymore. When calling a UNLINK url you must provide in your header at least one link header formatted as follow :
``<http://example.com/resources/{id}\>; rel="kind_of_relation"``

Important note about **link** and **unlink**: The implementation of the request listener extracting the resources as entities is not provided
by this bundle. A good implementation can be found here : http://williamdurand.fr/2012/08/02/rest-apis-with-symfony2-the-right-way/
It also contains some examples on how to use it.


### Conventional Actions ### Conventional Actions


Expand Down

0 comments on commit 2d4467d

Please sign in to comment.