Commit badec168 authored by Fabien Potencier's avatar Fabien Potencier

minor #1184 Update usage.rst (SpacePossum)

This PR was merged into the 1.3 branch.

Discussion
----------

Update usage.rst

* List all HTTP methods
* Update the error handling priority text
* Add link to error to exception cookbook entry
* Add link to the Twig provider documentation

Commits
-------

45da7908 Update usage.rst
parents 6f559e46 45da7908
...@@ -182,7 +182,7 @@ Other methods ...@@ -182,7 +182,7 @@ Other methods
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
You can create controllers for most HTTP methods. Just call one of these You can create controllers for most HTTP methods. Just call one of these
methods on your application: ``get``, ``post``, ``put``, ``delete``:: methods on your application: ``get``, ``post``, ``put``, ``delete``, ``patch``, ``options``::
$app->put('/blog/{id}', function ($id) { $app->put('/blog/{id}', function ($id) {
// ... // ...
...@@ -509,8 +509,8 @@ setting a more specific type hint for the Closure argument:: ...@@ -509,8 +509,8 @@ setting a more specific type hint for the Closure argument::
return new Response('Error', 404 /* ignored */, array('X-Status-Code' => 200)); return new Response('Error', 404 /* ignored */, array('X-Status-Code' => 200));
If you want to use a separate error handler for logging, make sure you register If you want to use a separate error handler for logging, make sure you register
it before the response error handlers, because once a response is returned, the it with a higher priority then response error handlers, because once a response
following handlers are ignored. is returned, the following handlers are ignored.
.. note:: .. note::
...@@ -546,6 +546,8 @@ early:: ...@@ -546,6 +546,8 @@ early::
return new Response(...); return new Response(...);
}); });
You can convert errors to ``Exceptions``, check out the cookbook :doc:`chapter <cookbook/error_handler>` for details.
View Handlers View Handlers
------------- -------------
...@@ -763,7 +765,7 @@ Cross-Site-Scripting attacks. ...@@ -763,7 +765,7 @@ Cross-Site-Scripting attacks.
}); });
If you use the Twig template engine, you should use its escaping or even If you use the Twig template engine, you should use its escaping or even
auto-escaping mechanisms. auto-escaping mechanisms. Check out the *Providers* :doc:`chapter <providers/twig>` for details.
* **Escaping JSON**: If you want to provide data in JSON format you should * **Escaping JSON**: If you want to provide data in JSON format you should
use the Silex ``json`` function:: use the Silex ``json`` function::
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment