Skip to content

Commit bce92d6

Browse files
Adding link to using annotations from routing book page
1 parent 2c3d526 commit bce92d6

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

book/routing.rst

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ areas of your application. By the end of this chapter, you'll be able to:
1818

1919
* Create complex routes that map to controllers
2020
* Generate URLs inside templates and controllers
21-
* Load routing resources from bundles (or anywhere else)
21+
* Load routing resources from bundles (or anywhere else)
2222
* Debug your routes
2323

2424
.. index::
@@ -90,7 +90,7 @@ pattern that points to a specific PHP class and method:
9090
{
9191
// use the $slug variable to query the database
9292
$blog = ...;
93-
93+
9494
return $this->render('AcmeBlogBundle:Blog:show.html.twig', array(
9595
'blog' => $blog,
9696
));
@@ -103,7 +103,7 @@ will be executed and the ``$slug`` variable will be equal to ``my-post``.
103103

104104
This is the goal of the Symfony2 router: to map the URL of a request to a
105105
controller. Along the way, you'll learn all sorts of tricks that make mapping
106-
even the most complex URLs easy.
106+
even the most complex URLs easy.
107107

108108
.. index::
109109
single: Routing; Under the hood
@@ -821,7 +821,7 @@ The controller might look like this:
821821
namespace Acme\BlogBundle\Controller;
822822
823823
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
824-
824+
825825
class BlogController extends Controller
826826
{
827827
public function showAction($slug)
@@ -1015,6 +1015,11 @@ instead of simply ``/hello/{name}``:
10151015
The string ``/admin`` will now be prepended to the pattern of each route
10161016
loaded from the new routing resource.
10171017

1018+
.. tip::
1019+
1020+
You can also define routes using annotations. See the :doc:`FrameworkExtraBundle documentation<bundles/SensioFrameworkExtraBundle/annotations/routing>`
1021+
to see how to.
1022+
10181023
.. index::
10191024
single: Routing; Debugging
10201025

@@ -1091,9 +1096,9 @@ In an upcoming section, you'll learn how to generate URLs from inside templates.
10911096
If the frontend of your application uses AJAX requests, you might want
10921097
to be able to generate URLs in JavaScript based on your routing configuration.
10931098
By using the `FOSJsRoutingBundle`_, you can do exactly that:
1094-
1099+
10951100
.. code-block:: javascript
1096-
1101+
10971102
var url = Routing.generate('blog_show', { "slug": 'my-blog-post'});
10981103
10991104
For more information, see the documentation for that bundle.
@@ -1120,9 +1125,9 @@ method:
11201125
on server information supplied by PHP. When generating absolute URLs for
11211126
scripts run from the command line, you'll need to manually set the desired
11221127
host on the ``RequestContext`` object:
1123-
1128+
11241129
.. code-block:: php
1125-
1130+
11261131
$router->getContext()->setHost('www.example.com');
11271132
11281133
.. index::

0 commit comments

Comments
 (0)