Skip to content

Commit 72f19a9

Browse files
committed
Merge branch '2.2' into 2.3
Conflicts: book/forms.rst book/installation.rst book/security.rst book/translation.rst components/config/definition.rst components/console/helpers/dialoghelper.rst components/process.rst cookbook/configuration/pdo_session_storage.rst cookbook/doctrine/registration_form.rst cookbook/form/inherit_data_option.rst cookbook/form/unit_testing.rst cookbook/routing/method_parameters.rst quick_tour/the_big_picture.rst
2 parents c372bbf + 74ed0f2 commit 72f19a9

File tree

99 files changed

+1215
-525
lines changed

Some content is hidden

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

99 files changed

+1215
-525
lines changed

book/controller.rst

+4-1
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,10 @@ For example, imagine you're processing a form submit::
670670
if ($form->isValid()) {
671671
// do some sort of processing
672672

673-
$this->get('session')->getFlashBag()->add('notice', 'Your changes were saved!');
673+
$this->get('session')->getFlashBag()->add(
674+
'notice',
675+
'Your changes were saved!'
676+
);
674677

675678
return $this->redirect($this->generateUrl(...));
676679
}

book/doctrine.rst

+22-8
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ information. By convention, this information is usually configured in an
9191
</doctrine:config>
9292
9393
.. code-block:: php
94-
94+
9595
// app/config/config.php
9696
$configuration->loadFromExtension('doctrine', array(
9797
'dbal' => array(
@@ -208,11 +208,12 @@ just a simple PHP class.
208208
.. tip::
209209

210210
Once you learn the concepts behind Doctrine, you can have Doctrine create
211-
simple entity classes for you:
211+
simple entity classes for you. This will ask you interactive questions
212+
to help you build any entity:
212213

213214
.. code-block:: bash
214215
215-
$ php app/console doctrine:generate:entity --entity="AcmeStoreBundle:Product" --fields="name:string(255) price:float description:text"
216+
$ php app/console doctrine:generate:entity
216217
217218
.. index::
218219
single: Doctrine; Adding mapping metadata
@@ -363,6 +364,8 @@ see the :ref:`book-doctrine-field-types` section.
363364
class Product
364365
// ...
365366

367+
.. _book-doctrine-generating-getters-and-setters:
368+
366369
Generating Getters and Setters
367370
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
368371

@@ -425,6 +428,8 @@ mapping information) of a bundle or an entire namespace:
425428
The getters and setters are generated here only because you'll need them
426429
to interact with your PHP object.
427430

431+
.. _book-doctrine-creating-the-database-tables-schema:
432+
428433
Creating the Database Tables/Schema
429434
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
430435

@@ -696,7 +701,10 @@ a controller, do the following::
696701

697702
$em = $this->getDoctrine()->getManager();
698703
$query = $em->createQuery(
699-
'SELECT p FROM AcmeStoreBundle:Product p WHERE p.price > :price ORDER BY p.price ASC'
704+
'SELECT p
705+
FROM AcmeStoreBundle:Product p
706+
WHERE p.price > :price
707+
ORDER BY p.price ASC'
700708
)->setParameter('price', '19.99');
701709

702710
$products = $query->getResult();
@@ -858,7 +866,9 @@ ordered alphabetically.
858866
public function findAllOrderedByName()
859867
{
860868
return $this->getEntityManager()
861-
->createQuery('SELECT p FROM AcmeStoreBundle:Product p ORDER BY p.name ASC')
869+
->createQuery(
870+
'SELECT p FROM AcmeStoreBundle:Product p ORDER BY p.name ASC'
871+
)
862872
->getResult();
863873
}
864874
}
@@ -937,7 +947,7 @@ To relate the ``Category`` and ``Product`` entities, start by creating a
937947
products:
938948
targetEntity: Product
939949
mappedBy: category
940-
# don't forget to init the collection in entity __construct() method
950+
# don't forget to init the collection in the __construct() method of the entity
941951
942952
.. code-block:: xml
943953
@@ -954,7 +964,10 @@ To relate the ``Category`` and ``Product`` entities, start by creating a
954964
mapped-by="category"
955965
/>
956966
957-
<!-- don't forget to init the collection in entity __construct() method -->
967+
<!--
968+
don't forget to init the collection in
969+
the __construct() method of the entity
970+
-->
958971
</entity>
959972
</doctrine-mapping>
960973
@@ -1325,7 +1338,8 @@ the current date, only when the entity is first persisted (i.e. inserted):
13251338
<entity name="Acme\StoreBundle\Entity\Product">
13261339
<!-- ... -->
13271340
<lifecycle-callbacks>
1328-
<lifecycle-callback type="prePersist" method="setCreatedValue" />
1341+
<lifecycle-callback type="prePersist"
1342+
method="setCreatedValue" />
13291343
</lifecycle-callbacks>
13301344
</entity>
13311345
</doctrine-mapping>

book/forms.rst

+27-14
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,10 @@ object.
386386
$metadata->addPropertyConstraint('task', new NotBlank());
387387
388388
$metadata->addPropertyConstraint('dueDate', new NotBlank());
389-
$metadata->addPropertyConstraint('dueDate', new Type('\DateTime'));
389+
$metadata->addPropertyConstraint(
390+
'dueDate',
391+
new Type('\DateTime')
392+
);
390393
}
391394
}
392395
@@ -496,7 +499,10 @@ to an array callback::
496499
public function setDefaultOptions(OptionsResolverInterface $resolver)
497500
{
498501
$resolver->setDefaults(array(
499-
'validation_groups' => array('Acme\\AcmeBundle\\Entity\\Client', 'determineValidationGroups'),
502+
'validation_groups' => array(
503+
'Acme\AcmeBundle\Entity\Client',
504+
'determineValidationGroups',
505+
),
500506
));
501507
}
502508

@@ -1082,7 +1088,8 @@ easy to use in your application.
10821088
.. code-block:: xml
10831089
10841090
<!-- src/Acme/TaskBundle/Resources/config/services.xml -->
1085-
<service id="acme_demo.form.type.task" class="Acme\TaskBundle\Form\Type\TaskType">
1091+
<service id="acme_demo.form.type.task"
1092+
class="Acme\TaskBundle\Form\Type\TaskType">
10861093
<tag name="form.type" alias="task" />
10871094
</service>
10881095
@@ -1092,7 +1099,10 @@ easy to use in your application.
10921099
use Symfony\Component\DependencyInjection\Definition;
10931100
10941101
$container
1095-
->register('acme_demo.form.type.task', 'Acme\TaskBundle\Form\Type\TaskType')
1102+
->register(
1103+
'acme_demo.form.type.task',
1104+
'Acme\TaskBundle\Form\Type\TaskType'
1105+
)
10961106
->addTag('form.type', array(
10971107
'alias' => 'task',
10981108
))
@@ -1458,13 +1468,13 @@ rendered (e.g. ``label``, ``widget``, ``errors``, etc). By default, there
14581468
are 4 possible *parts* of a form that can be rendered:
14591469

14601470
+-------------+--------------------------+---------------------------------------------------------+
1461-
| ``label`` | (e.g. ``form_label``) | renders the field's label |
1471+
| ``label`` | (e.g. ``form_label``) | renders the field's label |
14621472
+-------------+--------------------------+---------------------------------------------------------+
1463-
| ``widget`` | (e.g. ``form_widget``) | renders the field's HTML representation |
1473+
| ``widget`` | (e.g. ``form_widget``) | renders the field's HTML representation |
14641474
+-------------+--------------------------+---------------------------------------------------------+
1465-
| ``errors`` | (e.g. ``form_errors``) | renders the field's errors |
1475+
| ``errors`` | (e.g. ``form_errors``) | renders the field's errors |
14661476
+-------------+--------------------------+---------------------------------------------------------+
1467-
| ``row`` | (e.g. ``form_row``) | renders the field's entire row (label, widget & errors) |
1477+
| ``row`` | (e.g. ``form_row``) | renders the field's entire row (label, widget & errors) |
14681478
+-------------+--------------------------+---------------------------------------------------------+
14691479

14701480
.. note::
@@ -1609,7 +1619,6 @@ file:
16091619
- 'AcmeTaskBundle:Form'
16101620
# ...
16111621
1612-
16131622
.. code-block:: xml
16141623
16151624
<!-- app/config/config.xml -->
@@ -1778,6 +1787,11 @@ The answer is to setup the constraints yourself, and attach them to the individu
17781787
fields. The overall approach is covered a bit more in the :ref:`validation chapter<book-validation-raw-values>`,
17791788
but here's a short example:
17801789

1790+
.. versionadded:: 2.1
1791+
The ``constraints`` option, which accepts a single constraint or an array
1792+
of constraints (before 2.1, the option was called ``validation_constraint``,
1793+
and only accepted a single constraint) is new to Symfony 2.1.
1794+
17811795
.. code-block:: php
17821796
17831797
use Symfony\Component\Validator\Constraints\Length;
@@ -1797,15 +1811,14 @@ but here's a short example:
17971811
17981812
.. tip::
17991813

1800-
If you are using Validation Groups, you need to either reference the
1801-
``Default`` group when creating the form, or set the correct group on
1814+
If you are using Validation Groups, you need to either reference the
1815+
``Default`` group when creating the form, or set the correct group on
18021816
the constraint you are adding.
1803-
1817+
18041818
.. code-block:: php
18051819
18061820
new NotBlank(array('groups' => array('create', 'update'))
1807-
1808-
1821+
18091822
Final Thoughts
18101823
--------------
18111824

book/from_flat_php_to_symfony2.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,8 @@ Add a Touch of Symfony2
422422

423423
Symfony2 to the rescue. Before actually using Symfony2, you need to download
424424
it. This can be done by using Composer, which takes care of downloading the
425-
correct version and all its dependencies and provides an autoloader. An
426-
autoloader is a tool that makes it possible to start using PHP classes
425+
correct version and all its dependencies and provides an autoloader. An
426+
autoloader is a tool that makes it possible to start using PHP classes
427427
without explicitly including the file containing the class.
428428

429429
In your root directory, create a ``composer.json`` file with the following
@@ -439,7 +439,7 @@ content:
439439
"files": ["model.php","controllers.php"]
440440
}
441441
}
442-
442+
443443
Next, `download Composer`_ and then run the following command, which will download Symfony
444444
into a vendor/ directory:
445445

@@ -448,7 +448,7 @@ into a vendor/ directory:
448448
$ php composer.phar install
449449
450450
Beside downloading your dependencies, Composer generates a ``vendor/autoload.php`` file,
451-
which takes care of autoloading for all the files in the Symfony Framework as well as
451+
which takes care of autoloading for all the files in the Symfony Framework as well as
452452
the files mentioned in the autoload section of your ``composer.json``.
453453

454454
Core to Symfony's philosophy is the idea that an application's main job is

book/http_fundamentals.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ the user is connecting via a secured connection (i.e. ``https``).
270270
``attributes`` property exists entirely to be a place where you can
271271
prepare and store context-specific information about the request.
272272

273-
274273
Symfony also provides a ``Response`` class: a simple PHP representation of
275274
an HTTP response message. This allows your application to use an object-oriented
276275
interface to construct the response that needs to be returned to the client::
@@ -358,7 +357,7 @@ Stay Organized
358357
~~~~~~~~~~~~~~
359358

360359
Inside your front controller, you have to figure out which code should be
361-
executed and what the content to return should be. To figure this out, you'll
360+
executed and what the content to return should be. To figure this out, you'll
362361
need to check the incoming URI and execute different parts of your code depending
363362
on that value. This can get ugly quickly::
364363

@@ -449,7 +448,7 @@ by adding an entry for ``/contact`` to your routing configuration file:
449448
450449
.. note::
451450

452-
This example uses :doc:`YAML</components/yaml/introduction>` to define the routing
451+
This example uses :doc:`YAML</components/yaml/format>` to define the routing
453452
configuration. Routing configuration can also be written in other formats
454453
such as XML or PHP.
455454

@@ -459,6 +458,8 @@ the ``AcmeDemoBundle:Main:contact`` string is a short syntax that points to a
459458
specific PHP method ``contactAction`` inside a class called ``MainController``::
460459

461460
// src/Acme/DemoBundle/Controller/MainController.php
461+
namespace Acme\DemoBundle\Controller;
462+
462463
use Symfony\Component\HttpFoundation\Response;
463464

464465
class MainController

book/installation.rst

+9-10
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Distribution:
5757

5858
.. code-block:: bash
5959
60-
php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.3.0
60+
$ php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.3.0
6161
6262
.. tip::
6363

@@ -188,14 +188,13 @@ Symfony itself - into the ``vendor/`` directory.
188188
When running ``php composer.phar install`` or ``php composer.phar update``,
189189
composer will execute post install/update commands to clear the cache
190190
and install assets. By default, the assets will be copied into your ``web``
191-
directory.
191+
directory.
192192

193193
Instead of copying your Symfony assets, you can create symlinks if
194194
your operating system supports it. To create symlinks, add an entry
195195
in the ``extra`` node of your composer.json file with the key
196196
``symfony-assets-install`` and the value ``symlink``:
197197

198-
199198
.. code-block:: json
200199
201200
"extra": {
@@ -239,7 +238,7 @@ If there are any issues, correct them now before moving on.
239238
On a UNIX system, this can be done with one of the following commands:
240239

241240
.. code-block:: bash
242-
241+
243242
$ ps aux | grep httpd
244243
245244
or
@@ -261,7 +260,7 @@ If there are any issues, correct them now before moving on.
261260
262261
$ sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
263262
$ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
264-
263+
265264
**2. Using Acl on a system that does not support chmod +a**
266265

267266
Some systems don't support ``chmod +a``, but do support another utility
@@ -304,12 +303,12 @@ Symfony2 should welcome and congratulate you for your hard work so far!
304303
.. image:: /images/quick_tour/welcome.png
305304

306305
.. tip::
307-
308-
To get nice and short urls you should point the document root of your
309-
webserver or virtual host to the ``Symfony/web/`` directory. Though
310-
this is not required for development it is recommended at the time your
306+
307+
To get nice and short urls you should point the document root of your
308+
webserver or virtual host to the ``Symfony/web/`` directory. Though
309+
this is not required for development it is recommended at the time your
311310
application goes into production as all system and configuration files
312-
become inaccessible to clients then. For information on configuring
311+
become inaccessible to clients then. For information on configuring
313312
your specific web server document root, read
314313
:doc:`/cookbook/configuration/web_server_configuration`
315314
or consult the official documentation of your webserver:

0 commit comments

Comments
 (0)