Skip to content

Commit 40e2201

Browse files
committed
minor tweaks
1 parent 3313d56 commit 40e2201

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

controller.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -766,15 +766,17 @@ abstraction around the HTTP response - the text-based message filled with
766766
headers and content that's sent back to the client::
767767

768768
use Symfony\Component\HttpFoundation\Response;
769+
use Symfony\Component\HttpFoundation\JsonResponse;
769770

770771
// create a simple Response with a 200 status code (the default)
771772
$response = new Response('Hello '.$name, Response::HTTP_OK);
772773

773-
// create a JSON-response with a 200 status code
774-
$response = new Response(json_encode(array('name' => $name)));
775-
$response->headers->set('Content-Type', 'application/json');
774+
// JsonResponse is a sub-class of Response
775+
$response = new JsonResponse(array('name' => $name));
776+
// set a header!
777+
$response->headers->set('X-Rate-Limit', 10);
776778

777-
There are also special classes to make certain kinds of responses easier:
779+
There are special classes that make certain kinds of responses easier:
778780

779781
* For JSON, there is :class:`Symfony\\Component\\HttpFoundation\\JsonResponse`.
780782
See :ref:`component-http-foundation-json-response`.

page_creation.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ to creating a page?
8383
return a ``Response`` object. You'll learn more about :doc:`controllers </controllers>`
8484
in their own section, including how to return JSON responses;
8585

86+
The Web Debug Toolbar: Debugging Dream
87+
--------------------------------------
88+
89+
If your page is working, then you should *also* see a bar along the bottom of your
90+
browser. This is called the Web Debug Toolbar: and it's your debugging best friend.
91+
You'll learn more about all the information it holds along the way, but feel free
92+
to experiment: hover over and click the different icons to get information about
93+
routing, performance, logging and more.
94+
8695
Rendering a Template (with the Service Container)
8796
-------------------------------------------------
8897

routing.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ for you to use in your controller (keep reading). The ``blog_show`` is the
9494
internal name of the route, which doesn't have any meaning yet and just needs
9595
to be unique. Later, you'll use it to generate URLs.
9696

97-
If you don't want to use annotations, because you don't like them or because
98-
you don't want to depend on the SensioFrameworkExtraBundle, you can also use
99-
Yaml, XML or PHP. In these formats, the ``_controller`` parameter is a special
97+
If you don't want to use annotations, you can also use Yaml, XML or PHP. In these
98+
formats, the ``_controller`` parameter is a special
10099
key that tells Symfony which controller should be executed when a URL matches
101100
this route. The ``_controller`` string is called the
102101
:ref:`logical name <controller-string-syntax>`. It follows a pattern that
@@ -272,8 +271,8 @@ will be explained shortly in the :ref:`controller-string-syntax` section.
272271
.. index::
273272
single: Routing; Placeholders
274273

275-
Routing with Placeholders
276-
~~~~~~~~~~~~~~~~~~~~~~~~~
274+
Dynamic Routing with Placeholders
275+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
277276

278277
Of course the routing system supports much more interesting routes. Many
279278
routes will contain one or more named "wildcard" placeholders:

0 commit comments

Comments
 (0)