Skip to content

Commit d1bcc4e

Browse files
committed
Merge branch '2.1'
2 parents 19f2fdc + 40c83db commit d1bcc4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+216
-122
lines changed

book/controller.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ a serialized JSON array, an image, a redirect, a 404 error or anything else
1111
you can dream up. The controller contains whatever arbitrary logic *your
1212
application* needs to render the content of a page.
1313

14-
To see how simple this is, let's look at a Symfony2 controller in action.
14+
See how simple this is by looking at a Symfony2 controller in action.
1515
The following controller would render a page that simply prints ``Hello world!``::
1616

1717
use Symfony\Component\HttpFoundation\Response;
@@ -115,7 +115,7 @@ a controller object. Controllers are also called *actions*.
115115
will house several controllers/actions (e.g. ``updateAction``, ``deleteAction``,
116116
etc).
117117

118-
This controller is pretty straightforward, but let's walk through it:
118+
This controller is pretty straightforward:
119119

120120
* *line 4*: Symfony2 takes advantage of PHP 5.3 namespace functionality to
121121
namespace the entire controller class. The ``use`` keyword imports the

book/doctrine.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Databases and Doctrine
55
======================
66

7-
Let's face it, one of the most common and challenging tasks for any application
7+
One of the most common and challenging tasks for any application
88
involves persisting and reading information to and from a database. Fortunately,
99
Symfony comes integrated with `Doctrine`_, a library whose sole goal is to
1010
give you powerful tools to make this easy. In this chapter, you'll learn the
@@ -420,7 +420,7 @@ of the bundle:
420420
If you're following along with this example, you'll need to create a
421421
route that points to this action to see it work.
422422

423-
Let's walk through this example:
423+
Take a look at the previous example in more detail:
424424

425425
* **lines 9-12** In this section, you instantiate and work with the ``$product``
426426
object like any other, normal PHP object.
@@ -965,7 +965,7 @@ table, and ``product.category_id`` column, and new foreign key:
965965
Saving Related Entities
966966
~~~~~~~~~~~~~~~~~~~~~~~
967967

968-
Now, let's see the code in action. Imagine you're inside a controller::
968+
Now you can see this new code in action! Imagine you're inside a controller::
969969

970970
// ...
971971

book/forms.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ the correct values of a number of field options.
573573
* ``max_length``: If the field is some sort of text field, then the ``max_length``
574574
option can be guessed from the validation constraints (if ``Length`` or
575575
``Range`` is used) or from the Doctrine metadata (via the field's length).
576-
576+
577577
.. note::
578578

579579
These field options are *only* guessed if you're using Symfony to guess
@@ -625,7 +625,7 @@ of code. Of course, you'll usually need much more flexibility when rendering:
625625
<input type="submit" />
626626
</form>
627627

628-
Let's take a look at each part:
628+
Take a look at each part:
629629

630630
* ``form_enctype(form)`` - If at least one field is a file upload field, this
631631
renders the obligatory ``enctype="multipart/form-data"``;
@@ -1096,7 +1096,7 @@ In PHP, each form "fragment" is rendered via an individual template file.
10961096
To customize any part of how a form renders, you just need to override the
10971097
existing template by creating a new one.
10981098

1099-
To understand how this works, let's customize the ``form_row`` fragment and
1099+
To understand how this works, customize the ``form_row`` fragment and
11001100
add a class attribute to the ``div`` element that surrounds each row. To
11011101
do this, create a new template file that will store the new markup:
11021102

@@ -1340,7 +1340,7 @@ to define form output.
13401340
ever be needed in a single template.
13411341

13421342
.. caution::
1343-
1343+
13441344
This ``{% form_theme form _self %}`` functionality will *only* work
13451345
if your template extends another. If your template does not, you
13461346
must point ``form_theme`` to a separate template.

book/from_flat_php_to_symfony2.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ an autoloader that Symfony provides. An autoloader is a tool that makes it
426426
possible to start using PHP classes without explicitly including the file
427427
containing the class.
428428

429-
First, `download symfony`_ and place it into a ``vendor/symfony/symfony/`` directory.
429+
First, `download Symfony`_ and place it into a ``vendor/symfony/symfony/`` directory.
430430
Next, create an ``app/bootstrap.php`` file. Use it to ``require`` the two
431431
files in the application and to configure the autoloader:
432432

@@ -740,7 +740,7 @@ Learn more from the Cookbook
740740
* :doc:`/cookbook/controller/service`
741741

742742
.. _`Doctrine`: http://www.doctrine-project.org
743-
.. _`download symfony`: http://symfony.com/download
743+
.. _`download Symfony`: http://symfony.com/download
744744
.. _`Routing`: https://github.com/symfony/Routing
745745
.. _`Templating`: https://github.com/symfony/Templating
746746
.. _`KnpBundles.com`: http://knpbundles.com/

book/installation.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ Distribution:
6767
For an exact version, replace `dev-master` with the latest Symfony version
6868
(e.g. 2.1.1). For details, see the `Symfony Installation Page`_
6969

70+
.. tip::
71+
72+
To download the vendor files faster and without unnecessary directories
73+
(e.g. "Tests"), add the ``--prefer-dist`` option at the end of any Composer
74+
command.
75+
7076
This command may take several minutes to run as Composer download the Standard
7177
Distribution along with all of the vendor libraries that it needs. When it finishes,
7278
you should have a directory that looks something like this:
@@ -279,7 +285,7 @@ development! Your distribution may contain some sample code - check the
279285
to learn about what sample code was included with your distribution and how
280286
you can remove it later.
281287

282-
If you're new to Symfony, join us in the ":doc:`page_creation`", where you'll
288+
If you're new to Symfony, check out ":doc:`page_creation`", where you'll
283289
learn how to create pages, change configuration, and do everything else you'll
284290
need in your new application.
285291

book/service_container.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ you need it::
7979
$mailer = new Mailer('sendmail');
8080
$mailer->send('ryan@foobar.net', ...);
8181

82-
This is easy enough. The imaginary ``Mailer`` class allows us to configure
82+
This is easy enough. The imaginary ``Mailer`` class allows you to configure
8383
the method used to deliver the email messages (e.g. ``sendmail``, ``smtp``, etc).
8484
But what if you wanted to use the mailer service somewhere else? You certainly
8585
don't want to repeat the mailer configuration *every* time you need to use
@@ -312,7 +312,7 @@ Importing other Container Configuration Resources
312312
.. tip::
313313

314314
In this section, service configuration files are referred to as *resources*.
315-
This is to highlight that fact that, while most configuration resources
315+
This is to highlight the fact that, while most configuration resources
316316
will be files (e.g. YAML, XML, PHP), Symfony2 is so flexible that configuration
317317
could be loaded from anywhere (e.g. a database or even via an external
318318
web service).
@@ -576,7 +576,7 @@ This approach is fine, but what if you decide later that the ``NewsletterManager
576576
class needs a second or third constructor argument? What if you decide to
577577
refactor our code and rename the class? In both cases, you'd need to find every
578578
place where the ``NewsletterManager`` is instantiated and modify it. Of course,
579-
the service container gives us a much more appealing option:
579+
the service container gives you a much more appealing option:
580580

581581
.. configuration-block::
582582

book/testing.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,17 +236,19 @@ document::
236236
)
237237

238238
The ``server`` array is the raw values that you'd expect to normally
239-
find in the PHP `$_SERVER`_ superglobal. For example, to set the `Content-Type`
240-
and `Referer` HTTP headers, you'd pass the following::
239+
find in the PHP `$_SERVER`_ superglobal. For example, to set the `Content-Type`,
240+
`Referer` and `X-Requested-With' HTTP headers, you'd pass the following (mind
241+
the `HTTP_` prefix for non standard headers)::
241242

242243
$client->request(
243244
'GET',
244245
'/demo/hello/Fabien',
245246
array(),
246247
array(),
247248
array(
248-
'CONTENT_TYPE' => 'application/json',
249-
'HTTP_REFERER' => '/foo/bar',
249+
'CONTENT_TYPE' => 'application/json',
250+
'HTTP_REFERER' => '/foo/bar',
251+
'HTTP_X-Requested-With' => 'XMLHttpRequest',
250252
)
251253
);
252254

book/translation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,15 +831,15 @@ locale to use for translation::
831831
'Symfony2 is great',
832832
array(),
833833
'messages',
834-
'fr_FR',
834+
'fr_FR'
835835
);
836836

837837
$this->get('translator')->transChoice(
838838
'{0} There are no apples|{1} There is one apple|]1,Inf[ There are %count% apples',
839839
10,
840840
array('%count%' => 10),
841841
'messages',
842-
'fr_FR',
842+
'fr_FR'
843843
);
844844

845845
Translating Database Content

components/config/definition.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ By changing a string value into an associative array with ``name`` as the key::
440440
->ifString()
441441
->then(function($v) { return array('name'=> $v); })
442442
->end()
443-
->scalarValue('name')->isRequired()
443+
->scalarNode('name')->isRequired()
444444
// ...
445445
->end()
446446
;

components/console/introduction.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ You can install the component in many different ways:
2323
Creating a basic Command
2424
------------------------
2525

26-
To make a console command to greet us from the command line, create ``GreetCommand.php``
26+
To make a console command that greets you from the command line, create ``GreetCommand.php``
2727
and add the following to it::
2828

2929
namespace Acme\DemoBundle\Command;
@@ -138,6 +138,18 @@ Available foreground and background colors are: ``black``, ``red``, ``green``,
138138

139139
And available options are: ``bold``, ``underscore``, ``blink``, ``reverse`` and ``conceal``.
140140

141+
You can also set these colors and options inside the tagname::
142+
143+
// green text
144+
$output->writeln('<fg=green>foo</fg=green>');
145+
146+
// black text on a cyan background
147+
$output->writeln('<fg=black;bg=cyan>foo</fg=black;bg=cyan>');
148+
149+
// bold text on a yellow background
150+
$output->writeln('<bg=yellow;options=bold>foo</bg=yellow;options=bold>');
151+
152+
141153
Using Command Arguments
142154
-----------------------
143155

components/dependency_injection/advanced.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,5 @@ the service itself gets loaded. To do so, you can use the ``file`` directive.
121121
$definition->setFile('%kernel.root_dir%/src/path/to/file/foo.php');
122122
$container->setDefinition('foo', $definition);
123123
124-
Notice that symfony will internally call the PHP function require_once
124+
Notice that Symfony will internally call the PHP function require_once
125125
which means that your file will be included only once per request.

components/dependency_injection/definitions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ You can add a new argument to the end of the arguments array using::
9191

9292
$definition->addArgument($argument);
9393

94-
The argument can be a string, an array, a service parameter by using ``%paramater_name%``
94+
The argument can be a string, an array, a service parameter by using ``%parameter_name%``
9595
or a service id by using ::
9696

9797
use Symfony\Component\DependencyInjection\Reference;

components/dom_crawler.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Links
179179

180180
To find a link by name (or a clickable image by its ``alt`` attribute), use
181181
the ``selectLink`` method on an existing crawler. This returns a Crawler
182-
instance with just the selected link(s). Calling ``link()`` gives us a special
182+
instance with just the selected link(s). Calling ``link()`` gives you a special
183183
:class:`Symfony\\Component\\DomCrawler\\Link` object::
184184

185185
$linksCrawler = $crawler->selectLink('Go elsewhere...');
@@ -319,4 +319,4 @@ directly::
319319
$crawler = $client->submit($form);
320320

321321
.. _`Goutte`: https://github.com/fabpot/goutte
322-
.. _Packagist: https://packagist.org/packages/symfony/dom-crawler
322+
.. _Packagist: https://packagist.org/packages/symfony/dom-crawler

components/filesystem.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ endpoint for filesystem operations::
3333
try {
3434
$fs->mkdir('/tmp/random/dir/' . mt_rand());
3535
} catch (IOException $e) {
36-
echo "An error occured while creating your directory";
36+
echo "An error occurred while creating your directory";
3737
}
3838

3939
.. note::

components/http_foundation/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ by using the following methods:
227227
returns the list of accepted languages ordered by descending quality;
228228

229229
* :method:`Symfony\\Component\\HttpFoundation\\Request::getCharsets`:
230-
returns the list of accepted languages ordered by descending quality;
230+
returns the list of accepted charsets ordered by descending quality;
231231

232232
.. versionadded:: 2.2
233233
The :class:`Symfony\\Component\\HttpFoundation\\AcceptHeader` class is new in Symfony 2.2.

components/http_foundation/session_configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ Both methods return a Unix timestamp (relative to the server).
204204
This meta-data can be used to explicitly expire a session on access, e.g.::
205205

206206
$session->start();
207-
if (time() - $session->getMetadataBag()->getLastUpdate() > $maxIdleTime) {
207+
if (time() - $session->getMetadataBag()->getLastUsed() > $maxIdleTime) {
208208
$session->invalidate();
209209
throw new SessionExpired(); // redirect to expired session page
210210
}

components/http_foundation/sessions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Quick example::
3737

3838
.. note::
3939

40-
Symfony sessions are designed to replace several native PHP funtions.
40+
Symfony sessions are designed to replace several native PHP functions.
4141
Applications should avoid using ``session_start()``, ``session_regenerate_id()``,
4242
``session_id()``, ``session_name()``, and ``session_destroy()`` and instead
4343
use the APIs in the following section.
@@ -131,7 +131,7 @@ an array. A few methods exist for "Bag" management:
131131
Session meta-data
132132

133133
* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::getMetadataBag`:
134-
Gets the :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\MetadataBag`
134+
Gets the :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\MetadataBag`
135135
which contains information about the session.
136136

137137

@@ -239,7 +239,7 @@ Flash messages
239239
~~~~~~~~~~~~~~
240240

241241
The purpose of the :class:`Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface`
242-
is to provide a way of settings and retrieving messages on a per session basis.
242+
is to provide a way of setting and retrieving messages on a per session basis.
243243
The usual workflow for flash messages would be set in an request, and displayed
244244
after a page redirect. For example, a user submits a form which hits an update
245245
controller, and after processing the controller redirects the page to either the

components/yaml.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ When loading a YAML file, it is sometimes better to use the
122122
123123
use Symfony\Component\Yaml\Yaml;
124124
125-
$loader = Yaml::parse('/path/to/file.yml');
125+
$yaml = Yaml::parse('/path/to/file.yml');
126126
127127
The :method:`Symfony\\Component\\Yaml\\Yaml::parse` static method takes a YAML
128128
string or a file containing YAML. Internally, it calls the

contributing/code/conventions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ is a main relation:
3232
* a ``CookieJar`` has many ``Cookie`` objects;
3333

3434
* a Service ``Container`` has many services and many parameters (as services
35-
is the main relation, we use the naming convention for this relation);
35+
is the main relation, the naming convention is used for this relation);
3636

3737
* a Console ``Input`` has many arguments and many options. There is no "main"
3838
relation, and so the naming convention does not apply.
@@ -72,7 +72,7 @@ must be used instead (where ``XXX`` is the name of the related thing):
7272

7373
.. note::
7474

75-
While "setXXX" and "replaceXXX" are very similar, there is one notable
76-
difference: "setXXX" may replace, or add new elements to the relation.
75+
While "setXXX" and "replaceXXX" are very similar, there is one notable
76+
difference: "setXXX" may replace, or add new elements to the relation.
7777
"replaceXXX", on the other hand, cannot add new elements. If an unrecognized
7878
key as passed to "replaceXXX" it must throw an exception.

contributing/code/patches.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Set up your user information with your real name and a working email address:
2929
3030
.. tip::
3131

32-
If you are new to Git, we highly recommend you to read the excellent and
32+
If you are new to Git, you are highly recommended to read the excellent and
3333
free `ProGit`_ book.
3434

3535
.. tip::

0 commit comments

Comments
 (0)