Skip to content

Commit 2f59f6e

Browse files
committed
Merge branch '2.0' into 2.1
Conflicts: book/controller.rst book/from_flat_php_to_symfony2.rst book/page_creation.rst
2 parents 92c42c7 + 8038ebb commit 2f59f6e

File tree

7 files changed

+39
-38
lines changed

7 files changed

+39
-38
lines changed

book/controller.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ maps a URL to that controller (#2).
7373
.. note::
7474

7575
Though similarly named, a "front controller" is different from the
76-
"controllers" we'll talk about in this chapter. A front controller
76+
"controllers" talked about in this chapter. A front controller
7777
is a short PHP file that lives in your web directory and through which
7878
all requests are directed. A typical application will have a production
7979
front controller (e.g. ``app.php``) and a development front controller

book/from_flat_php_to_symfony2.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ The Sample Application in Symfony2
532532
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
533533

534534
The blog has come a *long* way, but it still contains a lot of code for such
535-
a simple application. Along the way, we've also invented a simple routing
535+
a simple application. Along the way, you've made a simple routing
536536
system and a method using ``ob_start()`` and ``ob_get_clean()`` to render
537537
templates. If, for some reason, you needed to continue building this "framework"
538538
from scratch, you could at least use Symfony's standalone `Routing`_ and
@@ -564,6 +564,7 @@ them for you. Here's the same sample application, now built in Symfony2::
564564
->getRepository('AcmeBlogBundle:Post')
565565
->find($id)
566566
;
567+
567568
if (!$post) {
568569
// cause the 404 page not found to be displayed
569570
throw $this->createNotFoundException();
@@ -613,7 +614,7 @@ The layout is nearly identical:
613614

614615
.. note::
615616

616-
We'll leave the show template as an exercise, as it should be trivial to
617+
The show template is left as an exercise, as it should be trivial to
617618
create based on the list template.
618619

619620
When Symfony2's engine (called the ``Kernel``) boots up, it needs a map so
@@ -729,8 +730,8 @@ The corresponding ``layout.html.twig`` template is also easier to write:
729730
</html>
730731

731732
Twig is well-supported in Symfony2. And while PHP templates will always
732-
be supported in Symfony2, we'll continue to discuss the many advantages of
733-
Twig. For more information, see the :doc:`templating chapter</book/templating>`.
733+
be supported in Symfony2, the many advantages of Twig will continue to
734+
be discussed. For more information, see the :doc:`templating chapter</book/templating>`.
734735

735736
Learn more from the Cookbook
736737
----------------------------

book/page_creation.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ of writing the HTML inside the controller, render a template instead:
299299
300300
.. note::
301301

302-
In order to use the :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::render`
303-
method, your controller must extend the
302+
In order to use the :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::render`
303+
method, your controller must extend the
304304
:class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller` class,
305305
which adds shortcuts for tasks that are common inside controllers. This
306306
is done in the above example by adding the ``use`` statement on line 4
@@ -476,7 +476,7 @@ use a Kernel class, ``AppKernel``, to bootstrap the application.
476476
http://localhost/hello/Ryan
477477
478478
Though front controllers are essential in handling every request, you'll
479-
rarely need to modify or even think about them. We'll mention them again
479+
rarely need to modify or even think about them. They'll be mentioned again
480480
briefly in the `Environments`_ section.
481481

482482
The Application (``app``) Directory

book/security.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ Users
883883
-----
884884

885885
In the previous sections, you learned how you can protect different resources
886-
by requiring a set of *roles* for a resource. In this section we'll explore
886+
by requiring a set of *roles* for a resource. This section explores
887887
the other side of authorization: users.
888888

889889
Where do Users come from? (*User Providers*)
@@ -1234,7 +1234,7 @@ In a controller this can be shortcut to:
12341234
method of an anonymous user object will return true. To check if your
12351235
user is actually authenticated, check for the ``IS_AUTHENTICATED_FULLY``
12361236
role.
1237-
1237+
12381238
In a Twig Template this object can be accessed via the ``app.user`` key,
12391239
which calls the :method:`GlobalVariables::getUser()<Symfony\\Bundle\\FrameworkBundle\\Templating\\GlobalVariables::getUser>`
12401240
method:
@@ -1627,7 +1627,7 @@ Access Control in Controllers
16271627
-----------------------------
16281628

16291629
If you want to check if the current user has a role in your controller, use
1630-
the :method:`Symfony\\Component\\Security\\Core\\SecurityContext::isGranted`
1630+
the :method:`Symfony\\Component\\Security\\Core\\SecurityContext::isGranted`
16311631
method of the security context::
16321632

16331633
public function indexAction()

book/templating.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ Template Inheritance and Layouts
175175
--------------------------------
176176

177177
More often than not, templates in a project share common elements, like the
178-
header, footer, sidebar or more. In Symfony2, we like to think about this
179-
problem differently: a template can be decorated by another one. This works
178+
header, footer, sidebar or more. In Symfony2, this problem is thought about
179+
differently: a template can be decorated by another one. This works
180180
exactly the same as PHP classes: template inheritance allows you to build
181181
a base "layout" template that contains all the common elements of your site
182182
defined as **blocks** (think "PHP class with base methods"). A child template
@@ -468,8 +468,8 @@ ease the work of the template designer. In PHP, the templating system provides
468468
an extensible *helper* system that provides useful features in a template
469469
context.
470470

471-
We've already seen a few built-in Twig tags (``{% block %}`` & ``{% extends %}``)
472-
as well as an example of a PHP helper (``$view['slots']``). Let's learn a
471+
You've already seen a few built-in Twig tags (``{% block %}`` & ``{% extends %}``)
472+
as well as an example of a PHP helper (``$view['slots']``). Here you will learn a
473473
few more.
474474

475475
.. index::
@@ -551,7 +551,7 @@ template using the ``with`` command.
551551
.. tip::
552552

553553
The ``{'article': article}`` syntax is the standard Twig syntax for hash
554-
maps (i.e. an array with named keys). If we needed to pass in multiple
554+
maps (i.e. an array with named keys). If you needed to pass in multiple
555555
elements, it would look like this: ``{'foo': foo, 'bar': bar}``.
556556

557557
.. index::
@@ -607,7 +607,7 @@ The ``recentList`` template is perfectly straightforward:
607607

608608
.. note::
609609

610-
Notice that we've cheated and hardcoded the article URL in this example
610+
Notice that the article URL is hardcoded in this example
611611
(e.g. ``/article/*slug*``). This is a bad practice. In the next section,
612612
you'll learn how to do this correctly.
613613

@@ -1117,7 +1117,7 @@ Three-level Inheritance
11171117
-----------------------
11181118

11191119
One common way to use inheritance is to use a three-level approach. This
1120-
method works perfectly with the three different types of templates we've just
1120+
method works perfectly with the three different types of templates that were just
11211121
covered:
11221122

11231123
* Create a ``app/Resources/views/base.html.twig`` file that contains the main

book/testing.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,11 @@ document::
227227

228228
request(
229229
$method,
230-
$uri,
231-
array $parameters = array(),
232-
array $files = array(),
233-
array $server = array(),
234-
$content = null,
230+
$uri,
231+
array $parameters = array(),
232+
array $files = array(),
233+
array $server = array(),
234+
$content = null,
235235
$changeHistory = true
236236
)
237237

@@ -435,8 +435,8 @@ it automatically. You can examine the response and force a redirection
435435
afterwards with the ``followRedirect()`` method::
436436

437437
$crawler = $client->followRedirect();
438-
439-
If you want the client to automatically follow all redirects, you can
438+
439+
If you want the client to automatically follow all redirects, you can
440440
force him with the ``followRedirects()`` method::
441441

442442
$client->followRedirects();
@@ -562,7 +562,7 @@ Just like links, you select forms with the ``selectButton()`` method::
562562

563563
.. note::
564564

565-
Notice that we select form buttons and not forms as a form can have several
565+
Notice that you select form buttons and not forms as a form can have several
566566
buttons; if you use the traversing API, keep in mind that you must look for a
567567
button.
568568

book/translation.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ the user::
2121

2222
The term *locale* refers roughly to the user's language and country. It
2323
can be any string that your application uses to manage translations
24-
and other format differences (e.g. currency format). We recommended the
24+
and other format differences (e.g. currency format). The
2525
`ISO639-1`_ *language* code, an underscore (``_``), then the `ISO3166 Alpha-2`_ *country*
26-
code (e.g. ``fr_FR`` for French/France).
26+
code (e.g. ``fr_FR`` for French/France) is recommended.
2727

28-
In this chapter, we'll learn how to prepare an application to support multiple
28+
In this chapter, you'll learn how to prepare an application to support multiple
2929
locales and then how to create translations for multiple locales. Overall,
3030
the process has several common steps:
3131

@@ -94,7 +94,7 @@ Translation of text is done through the ``translator`` service
9494
(:class:`Symfony\\Component\\Translation\\Translator`). To translate a block
9595
of text (called a *message*), use the
9696
:method:`Symfony\\Component\\Translation\\Translator::trans` method. Suppose,
97-
for example, that we're translating a simple message from inside a controller::
97+
for example, that you're translating a simple message from inside a controller::
9898

9999
public function indexAction()
100100
{
@@ -105,7 +105,7 @@ for example, that we're translating a simple message from inside a controller::
105105

106106
When this code is executed, Symfony2 will attempt to translate the message
107107
"Symfony2 is great" based on the ``locale`` of the user. For this to work,
108-
we need to tell Symfony2 how to translate the message via a "translation
108+
you need to tell Symfony2 how to translate the message via a "translation
109109
resource", which is a collection of message translations for a given locale.
110110
This "dictionary" of translations can be created in several different formats,
111111
XLIFF being the recommended format:
@@ -180,7 +180,7 @@ Sometimes, a message containing a variable needs to be translated::
180180
However, creating a translation for this string is impossible since the translator
181181
will try to look up the exact message, including the variable portions
182182
(e.g. "Hello Ryan" or "Hello Fabien"). Instead of writing a translation
183-
for every possible iteration of the ``$name`` variable, we can replace the
183+
for every possible iteration of the ``$name`` variable, you can replace the
184184
variable with a "placeholder"::
185185

186186
public function indexAction($name)
@@ -230,7 +230,7 @@ is done just as before:
230230
required when translating in Twig templates, and is overall a sensible
231231
convention to follow.
232232

233-
As we've seen, creating a translation is a two-step process:
233+
As you've seen, creating a translation is a two-step process:
234234

235235
#. Abstract the message that needs to be translated by processing it through
236236
the ``Translator``.
@@ -266,9 +266,9 @@ filesystem and discovered by Symfony, thanks to some conventions.
266266
Each time you create a *new* translation resource (or install a bundle
267267
that includes a translation resource), be sure to clear your cache so
268268
that Symfony can discover the new translation resource:
269-
269+
270270
.. code-block:: bash
271-
271+
272272
$ php app/console cache:clear
273273
274274
.. index::
@@ -392,11 +392,11 @@ Symfony2 will discover these files and use them when translating either
392392
locale (i.e. to translate ``symfony2.great`` to ``Symfony2 is great``).
393393

394394
The second method is handy because the message key won't need to be changed
395-
in every translation file if we decide that the message should actually
395+
in every translation file if you decide that the message should actually
396396
read "Symfony2 is really great" in the default locale.
397397

398398
The choice of which method to use is entirely up to you, but the "keyword"
399-
format is often recommended.
399+
format is often recommended.
400400

401401
Additionally, the ``php`` and ``yaml`` file formats support nested ids to
402402
avoid repeating yourself if you use keywords instead of real text for your
@@ -460,7 +460,7 @@ Symfony2 will discover these files and use them when translating either
460460
Using Message Domains
461461
---------------------
462462

463-
As we've seen, message files are organized into the different locales that
463+
As you've seen, message files are organized into the different locales that
464464
they translate. The message files can also be organized further into "domains".
465465
When creating message files, the domain is the first portion of the filename.
466466
The default domain is ``messages``. For example, suppose that, for organization,

0 commit comments

Comments
 (0)