From 5ef18439530fba9c4cb59230a679ed7779d89f4e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 18 Aug 2015 10:50:41 +0200 Subject: [PATCH 1/2] Updated the Quick Tour to the latest changes introduced by Symfony --- quick_tour/the_big_picture.rst | 44 ++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index f458fdfc439..dd1de331522 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -131,18 +131,18 @@ of database calls, HTML tags and other PHP code in the same script. To achieve this goal with Symfony, you'll first need to learn a few fundamental concepts. When developing a Symfony application, your responsibility as a developer -is to write the code that maps the user's *request* (e.g. ``http://localhost:8000/app/example``) +is to write the code that maps the user's *request* (e.g. ``http://localhost:8000/``) to the *resource* associated with it (the ``Homepage`` HTML page). The code to execute is defined in **actions** and **controllers**. The mapping between user's requests and that code is defined via the **routing** configuration. And the contents displayed in the browser are usually rendered using **templates**. -When you browsed ``http://localhost:8000/app/example`` earlier, Symfony executed -the controller defined in the ``src/AppBundle/Controller/DefaultController.php`` -file and rendered the ``app/Resources/views/default/index.html.twig`` template. -In the following sections you'll learn in detail the inner workings of Symfony -controllers, routes and templates. +When you browsed ``http://localhost:8000/`` earlier, Symfony executed the controller +defined in the ``src/AppBundle/Controller/DefaultController.php`` file and rendered +the ``app/Resources/views/default/index.html.twig`` template. In the following +sections you'll learn in detail the inner workings of Symfony controllers, routes +and templates. Actions and Controllers ~~~~~~~~~~~~~~~~~~~~~~~ @@ -155,11 +155,12 @@ because that will be explained in the next section):: use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; + use Symfony\Component\HttpFoundation\Request; class DefaultController extends Controller { /** - * @Route("/app/example", name="homepage") + * @Route("/", name="homepage") */ public function indexAction() { @@ -197,11 +198,12 @@ at the three lines of code above the ``indexAction`` method:: use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; + use Symfony\Component\HttpFoundation\Request; class DefaultController extends Controller { /** - * @Route("/app/example", name="homepage") + * @Route("/", name="homepage") */ public function indexAction() { @@ -217,15 +219,14 @@ start with ``/**``, whereas regular PHP comments start with ``/*``. The first value of ``@Route()`` defines the URL that will trigger the execution of the action. As you don't have to add the host of your application to the URL (e.g. ```http://example.com``), these URLs are always relative and -they are usually called *paths*. In this case, the ``/app/example`` path -refers to the application homepage. The second value of ``@Route()`` (e.g. -``name="homepage"``) is optional and sets the name of this route. For now -this name is not needed, but later it'll be useful for linking pages. +they are usually called *paths*. In this case, the ``/`` path refers to the +application homepage. The second value of ``@Route()`` (e.g. ``name="homepage"``) +is optional and sets the name of this route. For now this name is not needed, +but later it'll be useful for linking pages. -Considering all this, the ``@Route("/app/example", name="homepage")`` annotation -creates a new route called ``homepage`` which makes Symfony execute the -``index`` action of the ``Default`` controller when the user browses the -``/app/example`` path of the application. +Considering all this, the ``@Route("/", name="homepage")`` annotation creates a +new route called ``homepage`` which makes Symfony execute the ``index`` action +of the ``Default`` controller when the user browses the ``/`` path of the application. .. tip:: @@ -257,13 +258,14 @@ you'll see the following code: {% extends 'base.html.twig' %} {% block body %} - Homepage. +

Welcome to Symfony

+ + ... {% endblock %} -This template is created with `Twig`_, a new template engine created for -modern PHP applications. The -:doc:`second part of this tutorial ` will introduce -how templates work in Symfony. +This template is created with `Twig`_, a template engine created for modern PHP +applications. The :doc:`second part of this tutorial ` +explains how templates work in Symfony. .. _quick-tour-big-picture-environments: From 140fd91696025e774c49cc94f7bc9509f1831f0d Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 2 Sep 2015 16:23:57 +0200 Subject: [PATCH 2/2] Implemented all suggested changes --- quick_tour/the_big_picture.rst | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index dd1de331522..18c238b89c5 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -131,18 +131,18 @@ of database calls, HTML tags and other PHP code in the same script. To achieve this goal with Symfony, you'll first need to learn a few fundamental concepts. When developing a Symfony application, your responsibility as a developer -is to write the code that maps the user's *request* (e.g. ``http://localhost:8000/``) +is to write the code that maps the user's *request* (e.g. ``http://localhost:8000/``) to the *resource* associated with it (the ``Homepage`` HTML page). The code to execute is defined in **actions** and **controllers**. The mapping between user's requests and that code is defined via the **routing** configuration. And the contents displayed in the browser are usually rendered using **templates**. -When you browsed ``http://localhost:8000/`` earlier, Symfony executed the controller -defined in the ``src/AppBundle/Controller/DefaultController.php`` file and rendered -the ``app/Resources/views/default/index.html.twig`` template. In the following -sections you'll learn in detail the inner workings of Symfony controllers, routes -and templates. +When you browsed ``http://localhost:8000/app/example`` earlier, Symfony executed +the controller defined in the ``src/AppBundle/Controller/DefaultController.php`` +file and rendered the ``app/Resources/views/default/index.html.twig`` template. +In the following sections you'll learn in detail the inner workings of Symfony +controllers, routes and templates. Actions and Controllers ~~~~~~~~~~~~~~~~~~~~~~~ @@ -155,7 +155,6 @@ because that will be explained in the next section):: use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; - use Symfony\Component\HttpFoundation\Request; class DefaultController extends Controller { @@ -198,7 +197,6 @@ at the three lines of code above the ``indexAction`` method:: use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; - use Symfony\Component\HttpFoundation\Request; class DefaultController extends Controller { @@ -260,7 +258,7 @@ you'll see the following code: {% block body %}

Welcome to Symfony

- ... + {# ... #} {% endblock %} This template is created with `Twig`_, a template engine created for modern PHP