Skip to content
31 changes: 16 additions & 15 deletions quick_tour/the_architecture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ The Architecture
================

You are my hero! Who would have thought that you would still be here after the
first three parts? Your efforts will be well-rewarded soon. The first three
parts didn't look too deeply at the architecture of the framework. As it makes
Symfony2 stand apart from the framework crowd, let's dive into it now.
first three parts? Your efforts will be well rewarded soon. The first three
parts didn't look too deeply at the architecture of the framework. Because it makes
Symfony2 stand apart from the framework crowd, let's dive in to the architecture now.

Understanding the Directory Structure
-------------------------------------
Expand Down Expand Up @@ -237,10 +237,10 @@ specific configuration file:
Extending a Bundle
~~~~~~~~~~~~~~~~~~

In addition to be a nice way to organize and configure your code, a bundle can
extend another one (bundles support inheritance). It allows you to override
any existing bundle to customize its controllers, templates, and any file it
contains. This is where the logical names come in handy as they abstract where
In addition to being a nice way to organize and configure your code, a bundle can
extend another one. Bundle inheritance allows you to override
any existing bundle to customize its controllers, templates, and any of its files.
This is where the logical names come in handy, because they abstract where
the resource is actually stored.

For controllers, Symfony2 will automatically choose the right file according
Expand All @@ -257,10 +257,11 @@ For controllers, you need to reference method names:
``AcmeDemoBundle:Welcome:index`` means the ``indexAction`` method from the
``Acme\DemoBundle\Controller\WelcomeController`` class.

For templates, it is even more interesting as templates do not need to be
For templates, the logical name ``AcmeDemoBundle:Welcome:index.html.twig`` is
converted to the file path ``src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig``.
Templates become even more interesting when you realize they don't need to be
stored on the filesystem. You can easily store them in a database table for
instance. For instance, ``AcmeDemoBundle:Welcome:index.html.twig`` is
converted to ``src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig``.
instance.

Do you understand now why Symfony2 is so flexible? Share your bundles between
applications, store them locally or globally, your choice.
Expand All @@ -276,9 +277,9 @@ templating system, and some other third party libraries and bundles.
Understanding the Cache and Logs
--------------------------------

Symfony2 is probably one of the fastest full-stack frameworks around. But how
Symfony2 is probably one of the fastest full-stack frameworks around. How
can it be so fast if it parses and interprets tens of YAML and XML files for
each request? This is partly due to its cache system. The application
each request? The speed is partly due to its cache system. The application
configuration is only parsed for the very first request and then compiled down
to plain PHP code stored in the ``app/cache/`` directory. In the development
environment, Symfony2 is smart enough to flush the cache when you change a
Expand Down Expand Up @@ -312,9 +313,9 @@ Final Thoughts
--------------

Call me crazy, but after reading this part, you should be comfortable with
moving things around and making Symfony2 work for you. Everything is done in
Symfony2 to get out of your way. So, feel free to rename and move directories
around as you see fit.
moving things around and making Symfony2 work for you. Everything in
Symfony2 is deigned to get out of your way. So, feel free to rename and
move directories around as you see fit.

And that's all for the quick tour. From testing to sending emails, you still
need to learn a lot to become a Symfony2 master. Ready to dig into these
Expand Down
2 changes: 1 addition & 1 deletion quick_tour/the_big_picture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ retrieved through the ``$name`` method argument.

If you have a closer look at the action code, you can see that instead of
rendering a template like before, it just returns an array of parameters. The
``@extra:Template()`` annotation takes care of rendering a template which name
``@extra:Template()`` annotation takes care of rendering a template the name of which
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to wrap the line

is determined based on some simple conventions (it will render
``src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig``).

Expand Down
28 changes: 14 additions & 14 deletions quick_tour/the_controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ templates. It takes the route name and an array of parameters as arguments and
returns the associated friendly URL.

You can also easily forward the action to another one with the ``forward()``
method. As for the ``actions`` helper, it makes an internal sub-request, but
method. It makes an internal sub-request, but
it returns the ``Response`` object to allow for further modification::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should fix the wrapping here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I will.


$response = $this->forward('AcmeDemoBundle:Hello:fancy', array('name' => $name, 'color' => 'green'));
Expand Down Expand Up @@ -176,15 +176,15 @@ Moreover, the ``admin`` user has a ``ROLE_ADMIN`` role, which includes the

.. tip::

For readability, passwords are stored in clear in this simple
configuration, but using any hashing algorithm is a matter of tweaking the
For readability, passwords are stored in clear text in this simple
configuration, but you can use any hashing algorithm by tweaking the
``encoders`` section.

Going to the ``http://localhost/Symfony/web/app_dev.php/demo/secured/hello``
URL will automatically redirect you to the login form as this resource is
protected by a firewall via a login form.
URL will automatically redirect you to the login form because this resource is
protected by a ``firewall``.

You can also force a given role to be required by using the ``@extra:Secure``
You can also force the action to require a given role by using the ``@extra:Secure``
annotation on the controller::

/**
Expand All @@ -198,12 +198,12 @@ annotation on the controller::
}

Log in as ``user`` and from the secured hello page, click on the "Hello
resource secured" link; Symfony2 should return a 403 HTTP status code.
resource secured" link. Symfony2 should return a 403 HTTP status code.

.. note::

The Symfony2 security layer is very flexible and comes with many different
user provides (like one for the Doctrine ORM) and authentication providers
user providers (like one for the Doctrine ORM) and authentication providers
(like HTTP basic, HTTP digest, or X509 certificates). Read the
"`Security`_" chapter of the book for more information on how to use and
configure them.
Expand All @@ -230,23 +230,23 @@ In this example, the resource will be cached for a day. But you can also use
validation instead of expiration or a combination of both if that fits your
needs better.

Resource caching is managed by the Symfony2 built-in reverse. But as caching
is only managed by regular HTTP cache headers, you can also replace it with
Varnish or Squid and easily scale your application.
Resource caching is managed by the Symfony2 built-in reverse proxy. But because
caching is only managed by regular HTTP cache headers, you can replace the
built-in reverse proxy with Varnish or Squid and easily scale your application.

.. note::

But what if you cannot cache whole pages? Symfony2 still has the solution
via Edge Side Includes (ESI) that are supported natively. Learn more by
via Edge Side Includes (ESI) which are supported natively. Learn more by
reading the "`HTTP Cache`_" chapter of the book.

Final Thoughts
--------------

That's all there is to it, and I'm not even sure we have spent the allocated
10 minutes. We briefly introduced bundles in the first part; and all the
features we've learned about until now are part of the core framework bundle.
But thanks to bundles, everything can be extended or replaced in Symfony2.
features we've learned about so far are part of the core framework bundle.
But thanks to bundles, everything in Symfony2 can be extended or replaced.
That's the topic of the next part of this tutorial.

.. _Security: http://symfony.com/doc/2.0/book/security/index.html
Expand Down
2 changes: 1 addition & 1 deletion quick_tour/the_view.rst
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ Symfony2 provides the ``asset`` function to deal with them easily:

<img src="{{ asset('images/logo.png') }}" />

The ``asset`` function main purpose is to make your application more portable.
The ``asset`` function's main purpose is to make your application more portable.
Thanks to this function, you can move the application root directory anywhere
under your web root directory without changing anything in your template's
code.
Expand Down