Skip to content

Commit

Permalink
Merge branch '2.2' into 2.3
Browse files Browse the repository at this point in the history
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
  • Loading branch information
weaverryan committed Jul 1, 2013
2 parents c372bbf + 74ed0f2 commit 72f19a9
Show file tree
Hide file tree
Showing 99 changed files with 1,215 additions and 525 deletions.
5 changes: 4 additions & 1 deletion book/controller.rst
Expand Up @@ -670,7 +670,10 @@ For example, imagine you're processing a form submit::
if ($form->isValid()) {
// do some sort of processing

$this->get('session')->getFlashBag()->add('notice', 'Your changes were saved!');
$this->get('session')->getFlashBag()->add(
'notice',
'Your changes were saved!'
);

return $this->redirect($this->generateUrl(...));
}
Expand Down
30 changes: 22 additions & 8 deletions book/doctrine.rst
Expand Up @@ -91,7 +91,7 @@ information. By convention, this information is usually configured in an
</doctrine:config>
.. code-block:: php
// app/config/config.php
$configuration->loadFromExtension('doctrine', array(
'dbal' => array(
Expand Down Expand Up @@ -208,11 +208,12 @@ just a simple PHP class.
.. tip::

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

.. code-block:: bash
$ php app/console doctrine:generate:entity --entity="AcmeStoreBundle:Product" --fields="name:string(255) price:float description:text"
$ php app/console doctrine:generate:entity
.. index::
single: Doctrine; Adding mapping metadata
Expand Down Expand Up @@ -363,6 +364,8 @@ see the :ref:`book-doctrine-field-types` section.
class Product
// ...

.. _book-doctrine-generating-getters-and-setters:

Generating Getters and Setters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

.. _book-doctrine-creating-the-database-tables-schema:

Creating the Database Tables/Schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -696,7 +701,10 @@ a controller, do the following::

$em = $this->getDoctrine()->getManager();
$query = $em->createQuery(
'SELECT p FROM AcmeStoreBundle:Product p WHERE p.price > :price ORDER BY p.price ASC'
'SELECT p
FROM AcmeStoreBundle:Product p
WHERE p.price > :price
ORDER BY p.price ASC'
)->setParameter('price', '19.99');

$products = $query->getResult();
Expand Down Expand Up @@ -858,7 +866,9 @@ ordered alphabetically.
public function findAllOrderedByName()
{
return $this->getEntityManager()
->createQuery('SELECT p FROM AcmeStoreBundle:Product p ORDER BY p.name ASC')
->createQuery(
'SELECT p FROM AcmeStoreBundle:Product p ORDER BY p.name ASC'
)
->getResult();
}
}
Expand Down Expand Up @@ -937,7 +947,7 @@ To relate the ``Category`` and ``Product`` entities, start by creating a
products:
targetEntity: Product
mappedBy: category
# don't forget to init the collection in entity __construct() method
# don't forget to init the collection in the __construct() method of the entity
.. code-block:: xml
Expand All @@ -954,7 +964,10 @@ To relate the ``Category`` and ``Product`` entities, start by creating a
mapped-by="category"
/>
<!-- don't forget to init the collection in entity __construct() method -->
<!--
don't forget to init the collection in
the __construct() method of the entity
-->
</entity>
</doctrine-mapping>
Expand Down Expand Up @@ -1325,7 +1338,8 @@ the current date, only when the entity is first persisted (i.e. inserted):
<entity name="Acme\StoreBundle\Entity\Product">
<!-- ... -->
<lifecycle-callbacks>
<lifecycle-callback type="prePersist" method="setCreatedValue" />
<lifecycle-callback type="prePersist"
method="setCreatedValue" />
</lifecycle-callbacks>
</entity>
</doctrine-mapping>
Expand Down
41 changes: 27 additions & 14 deletions book/forms.rst
Expand Up @@ -386,7 +386,10 @@ object.
$metadata->addPropertyConstraint('task', new NotBlank());
$metadata->addPropertyConstraint('dueDate', new NotBlank());
$metadata->addPropertyConstraint('dueDate', new Type('\DateTime'));
$metadata->addPropertyConstraint(
'dueDate',
new Type('\DateTime')
);
}
}
Expand Down Expand Up @@ -496,7 +499,10 @@ to an array callback::
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'validation_groups' => array('Acme\\AcmeBundle\\Entity\\Client', 'determineValidationGroups'),
'validation_groups' => array(
'Acme\AcmeBundle\Entity\Client',
'determineValidationGroups',
),
));
}

Expand Down Expand Up @@ -1082,7 +1088,8 @@ easy to use in your application.
.. code-block:: xml
<!-- src/Acme/TaskBundle/Resources/config/services.xml -->
<service id="acme_demo.form.type.task" class="Acme\TaskBundle\Form\Type\TaskType">
<service id="acme_demo.form.type.task"
class="Acme\TaskBundle\Form\Type\TaskType">
<tag name="form.type" alias="task" />
</service>
Expand All @@ -1092,7 +1099,10 @@ easy to use in your application.
use Symfony\Component\DependencyInjection\Definition;
$container
->register('acme_demo.form.type.task', 'Acme\TaskBundle\Form\Type\TaskType')
->register(
'acme_demo.form.type.task',
'Acme\TaskBundle\Form\Type\TaskType'
)
->addTag('form.type', array(
'alias' => 'task',
))
Expand Down Expand Up @@ -1458,13 +1468,13 @@ rendered (e.g. ``label``, ``widget``, ``errors``, etc). By default, there
are 4 possible *parts* of a form that can be rendered:

+-------------+--------------------------+---------------------------------------------------------+
| ``label`` | (e.g. ``form_label``) | renders the field's label |
| ``label`` | (e.g. ``form_label``) | renders the field's label |
+-------------+--------------------------+---------------------------------------------------------+
| ``widget`` | (e.g. ``form_widget``) | renders the field's HTML representation |
| ``widget`` | (e.g. ``form_widget``) | renders the field's HTML representation |
+-------------+--------------------------+---------------------------------------------------------+
| ``errors`` | (e.g. ``form_errors``) | renders the field's errors |
| ``errors`` | (e.g. ``form_errors``) | renders the field's errors |
+-------------+--------------------------+---------------------------------------------------------+
| ``row`` | (e.g. ``form_row``) | renders the field's entire row (label, widget & errors) |
| ``row`` | (e.g. ``form_row``) | renders the field's entire row (label, widget & errors) |
+-------------+--------------------------+---------------------------------------------------------+

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

.. versionadded:: 2.1
The ``constraints`` option, which accepts a single constraint or an array
of constraints (before 2.1, the option was called ``validation_constraint``,
and only accepted a single constraint) is new to Symfony 2.1.

.. code-block:: php
use Symfony\Component\Validator\Constraints\Length;
Expand All @@ -1797,15 +1811,14 @@ but here's a short example:
.. tip::

If you are using Validation Groups, you need to either reference the
``Default`` group when creating the form, or set the correct group on
If you are using Validation Groups, you need to either reference the
``Default`` group when creating the form, or set the correct group on
the constraint you are adding.

.. code-block:: php
new NotBlank(array('groups' => array('create', 'update'))
Final Thoughts
--------------

Expand Down
8 changes: 4 additions & 4 deletions book/from_flat_php_to_symfony2.rst
Expand Up @@ -422,8 +422,8 @@ Add a Touch of Symfony2

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

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

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

Core to Symfony's philosophy is the idea that an application's main job is
Expand Down
7 changes: 4 additions & 3 deletions book/http_fundamentals.rst
Expand Up @@ -270,7 +270,6 @@ the user is connecting via a secured connection (i.e. ``https``).
``attributes`` property exists entirely to be a place where you can
prepare and store context-specific information about the request.


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

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

Expand Down Expand Up @@ -449,7 +448,7 @@ by adding an entry for ``/contact`` to your routing configuration file:
.. note::

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

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

// src/Acme/DemoBundle/Controller/MainController.php
namespace Acme\DemoBundle\Controller;

use Symfony\Component\HttpFoundation\Response;

class MainController
Expand Down
19 changes: 9 additions & 10 deletions book/installation.rst
Expand Up @@ -57,7 +57,7 @@ Distribution:

.. code-block:: bash
php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.3.0
$ php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.3.0
.. tip::

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

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


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

.. code-block:: bash
$ ps aux | grep httpd
or
Expand All @@ -261,7 +260,7 @@ If there are any issues, correct them now before moving on.
$ sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
$ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
**2. Using Acl on a system that does not support chmod +a**

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

.. tip::
To get nice and short urls you should point the document root of your
webserver or virtual host to the ``Symfony/web/`` directory. Though
this is not required for development it is recommended at the time your

To get nice and short urls you should point the document root of your
webserver or virtual host to the ``Symfony/web/`` directory. Though
this is not required for development it is recommended at the time your
application goes into production as all system and configuration files
become inaccessible to clients then. For information on configuring
become inaccessible to clients then. For information on configuring
your specific web server document root, read
:doc:`/cookbook/configuration/web_server_configuration`
or consult the official documentation of your webserver:
Expand Down

0 comments on commit 72f19a9

Please sign in to comment.