8000 [book][page_creation] Making the addition of the base controller clas… · chtitux/symfony-docs@b73df93 · GitHub
[go: up one dir, main page]

Skip to content

Commit b73df93

Browse files
committed
[book][page_creation] Making the addition of the base controller class more obvious
This is per feedback from a reader (Richard Harrington)
1 parent 8d32d7f commit b73df93

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

book/page_creation.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,12 @@ Create the Template
246246

247247
Templates allows us to move all of the presentation (e.g. HTML code) into
248248
a separate file and reuse different portions of the page layout. Instead
249-
of writing the HTML inside the controller, use a template instead::
249+
of writing the HTML inside the controller, use a template instead:
250250

251-
// src/Acme/HelloBundle/Controller/HelloController.php
251+
.. code-block:: php
252+
:linenos:
252253
254+
// src/Acme/HelloBundle/Controller/HelloController.php
253255
namespace Acme\HelloBundle\Controller;
254256
255257
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
@@ -267,9 +269,12 @@ of writing the HTML inside the controller, use a template instead::
267269
268270
.. note::
269271

270-
In order to use the ``render()`` method, you must extend the
271-
:class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller` class, which
272-
adds shortcuts for tasks that are common inside controllers.
272+
In order to use the ``render()`` method, your controller must extend the
273+
``Symfony\Bundle\FrameworkBundle\Controller\Controller`` class (API
274+
docs: :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller`),
275+
which adds shortcuts for tasks that are common inside controllers. This
276+
is done in the above example by adding the ``use`` statement on line 4
277+
and then extending ``Controller`` on line 6.
273278

274279
The ``render()`` method creates a ``Response`` object filled with the content
275280
of the given, rendered template. Like any other controller, you will ultimately

0 commit comments

Comments
 (0)
0