File tree

9 files changed

+63
-47
lines changed

9 files changed

+63
-47
lines changed
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,12 @@ the ``AcmeHelloBundle`` will be rendered.
505505
The Symfony templating engine is explained in great detail in the
506506
:doc:`Templating </book/templating>` chapter.
507507

508+
.. tip::
509+
510+
You can even avoid calling the ``render`` method by using the ``@Template``
511+
annotation. See the :doc:`FrameworkExtraBundle documentation</bundles/SensioFrameworkExtraBundle/annotations/view>`
512+
more details.
513+
508514
.. tip::
509515

510516
The ``renderView`` method is a shortcut to direct use of the ``templating``
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Caching on the Shoulders of Giants
2222
The most effective way to improve performance of an application is to cache
2323
the full output of a page and then bypass the application entirely on each
2424
subsequent request. Of course, this isn't always possible for highly dynamic
25-
websites, or is it? In this chapter, we'll show you how the Symfony2 cache
26-
system works and why we think this is the best possible approach.
25+
websites, or is it? In this chapter, you'll see how the Symfony2 cache
26+
system works and why this is the best possible approach.
2727

2828
The Symfony2 cache system is different because it relies on the simplicity
2929
and power of the HTTP cache as defined in the :term:`HTTP specification`.
@@ -32,8 +32,8 @@ that defines basic communication on the Web. Once you understand the fundamental
3232
HTTP validation and expiration caching models, you'll be ready to master
3333
the Symfony2 cache system.
3434

35-
For the purposes of learning how to cache with Symfony2, we'll cover the
36-
subject in four steps:
35+
For the purposes of learning how to cache with Symfony2, the
36+
subject is covered in four steps:
3737

3838
#. A :ref:`gateway cache <gateway-caches>`, or reverse proxy, is
3939
an independent layer that sits in front of your application. The reverse
@@ -57,8 +57,8 @@ subject in four steps:
5757
sidebar for only 5 minutes.
5858

5959
Since caching with HTTP isn't unique to Symfony, many articles already exist
60-
on the topic. If you're new to HTTP caching, we *highly* recommend Ryan
61-
Tomayko's article `Things Caches Do`_. Another in-depth resource is Mark
60+
on the topic. If you're new to HTTP caching, Ryan
61+
Tomayko's article `Things Caches Do`_ is *highly* recommended . Another in-depth resource is Mark
6262
Nottingham's `Cache Tutorial`_.
6363

6464
.. index::
@@ -118,8 +118,8 @@ different types of caches:
118118
.. note::
119119

120120
The significance of *private* versus *shared* caches will become more
121-
obvious as we talk about caching responses containing content that is
122-
specific to exactly one user (e.g. account information).
121+
obvious when caching responses containing content that is
122+
specific to exactly one user (e.g. account information) is discussed.
123123

124124
Each response from your application will likely go through one or both of
125125
the first two cache types. These caches are outside of your control but follow
@@ -171,7 +171,7 @@ from your application and returning them to the client.
171171
error_log($kernel->getLog());
172172

173173
The ``AppCache`` object has a sensible default configuration, but it can be
174-
finely tuned via a set of options you can set by overriding the
174+
finely tuned via a set of options you can set by overriding the
175175
:method:`Symfony\\Bundle\\FrameworkBundle\\HttpCache\\HttpCache::getOptions`
176176
method::
177177

@@ -239,8 +239,8 @@ misses.
239239
The Symfony2 reverse proxy is a great tool to use when developing your
240240
website or when you deploy your website to a shared host where you cannot
241241
install anything beyond PHP code. But being written in PHP, it cannot
242-
be as fast as a proxy written in C. That's why we highly recommend you
243-
to use Varnish or Squid on your production servers if possible. The good
242+
be as fast as a proxy written in C. That's why it is highly recommended you
243+
use Varnish or Squid on your production servers if possible. The good
244244
news is that the switch from one proxy server to another is easy and
245245
transparent as no code modification is needed in your application. Start
246246
easy with the Symfony2 reverse proxy and upgrade later to Varnish when
@@ -272,11 +272,10 @@ headers on the response.
272272

273273
Keep in mind that "HTTP" is nothing more than the language (a simple text
274274
language) that web clients (e.g. browsers) and web servers use to communicate
275-
with each other. When we talk about HTTP caching, we're talking about the
276-
part of that language that allows clients and servers to exchange information
277-
related to caching.
275+
with each other. HTTP caching is the part of that language that allows clients
276+
and servers to exchange information related to caching.
278277

279-
HTTP specifies four response cache headers that we're concerned with:
278+
HTTP specifies four response cache headers that are looked at here:
280279

281280
* ``Cache-Control``
282281
* ``Expires``
@@ -424,7 +423,7 @@ on a cache to store and return "fresh" responses.
424423
found in two dedicated parts (`P4 - Conditional Requests`_ and `P6 -
425424
Caching: Browser and intermediary caches`_).
426425

427-
As a web developer, we strongly urge you to read the specification. Its
426+
As a web developer, you are strongly urged to read the specification. Its
428427
clarity and power - even more than ten years after its creation - is
429428
invaluable. Don't be put-off by the appearance of the spec - its contents
430429
are much more beautiful than its cover.
@@ -567,16 +566,16 @@ md5 of the content::
567566
return $response;
568567
}
569568

570-
The :method:`Symfony\\Component\\HttpFoundation\\Response::isNotModified`
571-
method compares the ``ETag`` sent with the ``Request`` with the one set
572-
on the ``Response``. If the two match, the method automatically sets the
569+
The :method:`Symfony\\Component\\HttpFoundation\\Response::isNotModified`
570+
method compares the ``ETag`` sent with the ``Request`` with the one set
571+
on the ``Response``. If the two match, the method automatically sets the
573572
``Response`` status code to 304.
574573

575574
This algorithm is simple enough and very generic, but you need to create the
576575
whole ``Response`` before being able to compute the ETag, which is sub-optimal.
577576
In other words, it saves on bandwidth, but not CPU cycles.
578577

579-
In the :ref:`optimizing-cache-validation` section, we'll show how validation
578+
In the :ref:`optimizing-cache-validation` section, you'll see how validation
580579
can be used more intelligently to determine the validity of a cache without
581580
doing so much work.
582581

@@ -626,9 +625,9 @@ header value::
626625
return $response;
627626
}
628627

629-
The :method:`Symfony\\Component\\HttpFoundation\\Response::isNotModified`
630-
method compares the ``If-Modified-Since`` header sent by the request with
631-
the ``Last-Modified`` header set on the response. If they are equivalent,
628+
The :method:`Symfony\\Component\\HttpFoundation\\Response::isNotModified`
629+
method compares the ``If-Modified-Since`` header sent by the request with
630+
the ``Last-Modified`` header set on the response. If they are equivalent,
632631
the ``Response`` will be set to a 304 status code.
633632

634633
.. note::
@@ -664,7 +663,7 @@ exposing a simple and efficient pattern::
664663
$response = new Response();
665664
$response->setETag($article->computeETag());
666665
$response->setLastModified($article->getPublishedAt());
667-
666+
668667
// Set response as public. Otherwise it will be private by default.
669668
$response->setPublic();
670669

@@ -697,7 +696,7 @@ headers that must not be present for ``304`` responses (see
697696
Varying the Response
698697
~~~~~~~~~~~~~~~~~~~~
699698

700-
So far, we've assumed that each URI has exactly one representation of the
699+
So far, it's been assumed that each URI has exactly one representation of the
701700
target resource. By default, HTTP caching is done by using the URI of the
702701
resource as the cache key. If two people request the same URI of a cacheable
703702
resource, the second person will receive the cached version.
@@ -708,7 +707,7 @@ compress pages when the client supports it, any given URI has two representation
708707
one when the client supports compression, and one when it does not. This
709708
determination is done by the value of the ``Accept-Encoding`` request header.
710709

711-
In this case, we need the cache to store both a compressed and uncompressed
710+
In this case, you need the cache to store both a compressed and uncompressed
712711
version of the response for the particular URI and return them based on the
713712
request's ``Accept-Encoding`` value. This is done by using the ``Vary`` response
714713
header, which is a comma-separated list of different headers whose values
@@ -856,8 +855,8 @@ First, to use ESI, be sure to enable it in your application configuration:
856855
'esi' => array('enabled' => true),
857856
));
858857
859-
Now, suppose we have a page that is relatively static, except for a news
860-
ticker at the bottom of the content. With ESI, we can cache the news ticker
858+
Now, suppose you have a page that is relatively static, except for a news
859+
ticker at the bottom of the content. With ESI, you can cache the news ticker
861860
independent of the rest of the page.
862861

863862
.. code-block:: php
@@ -871,7 +870,7 @@ independent of the rest of the page.
871870
return $response;
872871
}
873872
874-
In this example, we've given the full-page cache a lifetime of ten minutes.
873+
In this example, the full-page cache has a lifetime of ten minutes.
875874
Next, let's include the news ticker in the template by embedding an action.
876875
This is done via the ``render`` helper (See :ref:`templating-embedding-controller`
877876
for more details).
@@ -966,8 +965,8 @@ the ``_internal`` route:
966965

967966
Since this route allows all actions to be accessed via a URL, you might
968967
want to protect it by using the Symfony2 firewall feature (by allowing
969-
access to your reverse proxy's IP range). See the :ref:`Securing by IP<book-security-securing-ip>`
970-
section of the :doc:`Security Chapter </book/security>` for more information
968+
access to your reverse proxy's IP range). See the :ref:`Securing by IP<book-security-securing-ip>`
969+
section of the :doc:`Security Chapter </book/security>` for more information
971970
on how to do this.
972971

973972
One great advantage of this caching strategy is that you can make your
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ each event has access to the same basic information:
208208

209209
* :method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getRequestType`
210210
- returns the *type* of the request (``HttpKernelInterface::MASTER_REQUEST``
211-
or ``HttpKernelInterface::SUB_REQUEST``);
211+
or ``HttpKernelInterface::SUB_REQUEST``);
212212

213213
* :method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getKernel`
214214
- returns the Kernel handling the request;
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ lots of services. Services that are never used are never constructed.
162162

163163
As an added bonus, the ``Mailer`` service is only created once and the same
164164
instance is returned each time you ask for the service. This is almost always
165-
the behavior you'll need (it's more flexible and powerful), but we'll learn
166-
later how you can configure a service that has multiple instances.
165+
the behavior you'll need (it's more flexible and powerful), but you learn how
166+
to configure a service that has multiple instances in the
167+
":doc:`/cookbook/service_container/scopes`" cookbook article.
167168

168169
.. _book-service-container-parameters:
169170

Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Before building it, the kernel checks to see if a cached version of the containe
2525
exists. The ``HttpKernel`` has a debug setting and if this is false, the
2626
cached version is used if it exists. If debug is true then the kernel
2727
:doc:`checks to see if configuration is fresh</components/config/caching>`
28-
and if it is, the cached version of the container is. If not then the container
28+
and if it is, the cached version of the container is used. If not then the container
2929
is built from the application-level configuration and the bundles's extension
3030
configuration.
3131

@@ -51,7 +51,7 @@ Bundle-level Configuration with Extensions
5151

5252
By convention, each bundle contains an Extension class which is in the bundle's
5353
``DependencyInjection`` directory. These are registered with the ``ContainerBuilder``
54-
when the kernel is booted. When the ``ContainerBuilder`` is :doc:`compiled</components/dependency-injection/compilation>`,
54+
when the kernel is booted. When the ``ContainerBuilder`` is :doc:`compiled</components/dependency_injection/compilation>`,
5555
the application-level configuration relevant to the bundle's extension is
5656
passed to the Extension which also usually loads its own config file(s), typically from the bundle's
5757
``Resources/config`` directory. The application-level config is usually processed
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ then clone your fork:
2525
2626
$ git clone git://.com/YOURUSERNAME/symfony-docs.git
2727
28+
Consistent with Symfony's source code, the documentation repository is split into
29+
three branches: ``2.0`` for the current Symfony 2.0.x release, ``2.1`` for the
30+
current Symfony 2.1.x release and ``master`` as the development branch for
31+
upcoming releases.
32+
2833
Unless you're documenting a feature that's new to Symfony 2.1, your changes
29-
should be based on the 2.0 branch instead of the master branch. To do this
30-
checkout the 2.0 branch before the next step:
34+
should always be based on the 2.0 branch instead of the master branch. To do
35+
this checkout the 2.0 branch before the next step:
3136

3237
.. code-block:: bash
3338
@@ -47,12 +52,17 @@ the ``symfony-docs`` ``master`` branch.
4752
.. image:: /images/docs-pull-request.png
4853
:align: center
4954

50-
If you have made your changes based on the 2.0 branch then you need to follow
51-
the change commit link and change the base branch to be @2.0:
55+
If you have made your changes based on the 2.0 branch then you need to change
56+
the base branch to be 2.0 on the preview page:
5257

5358
.. image:: /images/docs-pull-request-change-base.png
5459
:align: center
5560

61+
.. note::
62+
63+
All changes made to the 2.0 branch will be merged into 2.1 which in turn will be
64+
merged into the master branch for the next release on a weekly basis.
65+
5666
covers the topic of `pull requests`_ in detail.
5767

5868
.. note::
@@ -62,11 +72,11 @@ covers the topic of `pull requests`_ in detail.
6272

6373
.. tip::
6474

65-
Your changes appear on the symfony.com website no more than 15 minutes
66-
after the documentation team merges your pull request. You can check if
67-
your changes have introduced some markup issues by going to the
68-
`Documentation Build Errors`_ page (it is updated each French night at 3AM
69-
when the server rebuilds the documentation).
75+
Please be patient. It can take from 15 minutes to several days for your changes
76+
to appear on the symfony.com website after the documentation team merges your
77+
pull request. You can check if your changes have introduced some markup issues
78+
by going to the `Documentation Build Errors`_ page (it is updated each French
79+
night at 3AM when the server rebuilds the documentation).
7080

7181
Standards
7282
---------
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Creating Constraint class
1414

1515
First you need to create a Constraint class and extend :class:`Symfony\\Component\\Validator\\Constraint`::
1616

17-
// src/Acme/DemoBundle/Validator/constraints/ContainsAlphanumeric.php
17+
// src/Acme/DemoBundle/Validator/Constraints/ContainsAlphanumeric.php
1818
namespace Acme\DemoBundle\Validator\Constraints;
1919

2020
use Symfony\Component\Validator\Constraint;
Loading
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ of an ``Author`` class exactly equal to ``null``, you could do the following:
2929
Acme\BlogBundle\Entity\Author:
3030
properties:
3131
firstName:
32-
- Null: ~
32+
- 'Null': ~
3333
3434
.. code-block:: php-annotations
3535

0 commit comments

Comments
 (0)