Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Controller matching in the access control rules section #102

Closed
wants to merge 23 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
540223e
updated access control rules for matching a controller
Feb 14, 2011
e738be1
fixed the regex
Feb 14, 2011
1eed3e7
added Japanese translation of 01-The-Big-Picture.markdown
masakielastic Mar 17, 2010
5522f3d
[service_container] Initial import of the service container guide and…
weaverryan Feb 12, 2011
45e44a3
[reference] Bootstrapping the reference section.
weaverryan Feb 13, 2011
2b6003b
[service_container] Renaming everything to "Service Container", which…
weaverryan Feb 14, 2011
d6cb61a
[service_container] Fixing typo per Stof.
weaverryan Feb 14, 2011
7b1daa2
added missing files in the sandbox
fabpot Jun 30, 2010
543441b
added missing assets
fabpot Sep 16, 2010
c963d90
updated Templates and Final Thoughts
chaffneue Feb 6, 2011
27bf398
rephrasing Creating your first Application
ckwalsh Feb 5, 2011
c2998e9
updated Configuration
chaffneue Feb 5, 2011
bea2a8a
Improving Working with Environments
ckwalsh Feb 6, 2011
450e764
Better describing controllers
ckwalsh Feb 6, 2011
5aa1cde
updated Checking the Configuration
chaffneue Feb 5, 2011
0642e48
[Testing] fixed Form object retrieval with the Crawler instance
Feb 11, 2011
c31d60a
fixed typo
hidenorigoto Feb 12, 2011
80849f0
[Forms] Fixing an inline link by using the :ref: linking syntax.
weaverryan Feb 13, 2011
de617f6
[markup] Fixing two minor markup issues.
weaverryan Feb 13, 2011
2f97910
[Forms] Adding missing link to the form fields guide.
weaverryan Feb 13, 2011
1b0399c
[Forms] Reorganizing the form fields section to use a map file and ad…
weaverryan Feb 13, 2011
57bd1aa
updated Routing
chaffneue Feb 6, 2011
0f66b96
[quick_tour] Clarifying the namespace versus bundle name use in the c…
weaverryan Feb 11, 2011
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Better describing controllers
ckwalsh authored and srohweder committed Feb 14, 2011

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 450e76455009615b23381fcbd69407fe84f6f927
31 changes: 19 additions & 12 deletions quick_tour/the_big_picture.rst
Original file line number Diff line number Diff line change
@@ -206,8 +206,8 @@ controller, referenced by the ``_controller`` value.
Controllers
~~~~~~~~~~~

The controller is responsible for returning a representation of the resource
(most of the time an HTML one) and it is defined as a PHP class:
The controller defines actions to handle users requests and prepares responses
(often in HTML).

.. code-block:: php
:linenos:
@@ -231,21 +231,22 @@ The controller is responsible for returning a representation of the resource
The code is pretty straightforward but let's explain it line by line:

* *line 3*: Symfony2 takes advantage of new PHP 5.3 features and as such, all
controllers are properly namespaced (the namespace is the first part of the
``_controller`` routing value: ``HelloBundle``).
* *line 3*: Symfony2 takes advantage of new PHP 5.3 namespacing features, and
all controllers should be properly namespaced. Per the routing file above,
the namespace is the first part of the ``_controller`` routing value:
``HelloBundle``).

* *line 7*: The controller name is the concatenation of the second part of the
``_controller`` routing value (``Hello``) and ``Controller``. It extends the
built-in ``Controller`` class, which provides useful shortcuts (as we will
see later in this tutorial).
* *line 7*: The controller name is the combination of the second part of the
``_controller`` routing value (``Hello``) and the word ``Controller``. It
extends the built-in ``Controller`` class, which provides useful shortcuts
(as we will see later in this tutorial).

* *line 9*: Each controller is made of several actions. As per the
* *line 9*: Each controller is made of several actions. As per the routing
configuration, the hello page is handled by the ``index`` action (the third
part of the ``_controller`` routing value). This method receives the
resource placeholder values as arguments (``$name`` in our case).
placeholder values as arguments (``$name`` in our case).

* *line 11*: The ``render()`` method loads and renders a template
* *line 11*: The ``render()`` method loads and renders a template file
(``HelloBundle:Hello:index.html.twig``) with the variables passed as a
second argument.

@@ -255,6 +256,12 @@ organized in bundles. In Symfony2 speak, a bundle is a structured set of files
feature (a blog, a forum, ...) and which can be easily shared with other
developers. In our example, we only have one bundle, ``HelloBundle``.

.. tip::

In general, controller actions should be as short as possible. If one is
getting too long, consider refactoring some of the more complicated code to
the service layer (which will be discussed later).

Templates
~~~~~~~~~