Skip to content

Commit

Permalink
Merge branch '3.1'
Browse files Browse the repository at this point in the history
Conflicts:
	reference/configuration/framework.rst
  • Loading branch information
wouterj committed Oct 6, 2016
2 parents c5328d7 + 4240817 commit 2b027a9
Show file tree
Hide file tree
Showing 20 changed files with 102 additions and 66 deletions.
6 changes: 3 additions & 3 deletions best_practices/business-logic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Inside here, you can create whatever directories you want to organize things:

.. code-block:: text
symfony2-project/
symfony-project/
├─ app/
├─ src/
│ └─ AppBundle/
Expand All @@ -35,7 +35,7 @@ and put things there:

.. code-block:: text
symfony2-project/
symfony-project/
├─ app/
├─ src/
│ ├─ Acme/
Expand Down Expand Up @@ -180,7 +180,7 @@ The three entities defined by our sample blog application are a good example:

.. code-block:: text
symfony2-project/
symfony-project/
├─ ...
└─ src/
└─ AppBundle/
Expand Down
6 changes: 3 additions & 3 deletions best_practices/controllers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ it more difficult to know which template is being rendered. It also makes
it less obvious to beginners that a controller should always return a Response
object (unless you're using a view layer).

How the Controller Looks
------------------------
What does the Controller look like
----------------------------------

Considering all this, here is an example of how the controller should look
Considering all this, here is an example of what the controller should look like
for the homepage of our app:

.. code-block:: php
Expand Down
2 changes: 1 addition & 1 deletion components/cache/cache_pools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ is ``getItem($key)``, which returns the cache item identified by the given key::

use Symfony\Component\Cache\Adapter\FilesystemAdapter;

$cache = new FilesystemAdapter('app.cache')
$cache = new FilesystemAdapter('app.cache');
$latestNews = $cache->getItem('latest_news');

If no item is defined for the given key, the method doesn't return a ``null``
Expand Down
2 changes: 1 addition & 1 deletion components/expression_language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ How can the Expression Engine Help Me?
--------------------------------------

The purpose of the component is to allow users to use expressions inside
configuration for more complex logic. For some examples, the Symfony2 Framework
configuration for more complex logic. For some examples, the Symfony Framework
uses expressions in security, for validation rules and in route matching.

Besides using the component in the framework itself, the ExpressionLanguage
Expand Down
4 changes: 4 additions & 0 deletions components/filesystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ On POSIX filesystems, directories are created with a default mode value
You can pass an array or any :phpclass:`Traversable` object as the first
argument.

.. note::

This function ignores already existing directories.

exists
~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion components/yaml/yaml_format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ YAML uses the ISO-8601 standard to express dates:

.. code-block:: yaml
2001-12-14t21:59:43.10-05:00
2001-12-14T21:59:43.10-05:00
.. code-block:: yaml
Expand Down
6 changes: 3 additions & 3 deletions configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ There are *two* ways to know *what* keys you can configure:

#. Use the :doc:`Reference Section </reference/index>`;

#. Use the ``config:dump`` command;
#. Use the ``config:dump-reference`` command.

For example, if you want to configure something in Twig, you can see an example
dump of all available configuration options by running:

.. code-block:: terminal
$ php bin/console config:dump twig
$ php bin/console config:dump-reference twig
.. index::
single: Environments; Introduction
Expand Down Expand Up @@ -183,7 +183,7 @@ can also load XML files or PHP files.

.. _config-parameter-intro:

The parameters key: Parameters (Variables)
The parameters Key: Parameters (Variables)
------------------------------------------

Another special key is called ``parameters``: it's used to define *variables* that
Expand Down
4 changes: 2 additions & 2 deletions configuration/micro_kernel_trait.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ to hold the kernel. Now it looks like this::
// optional, to use the standard Symfony cache directory
public function getCacheDir()
{
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
return __DIR__.'/../var/cache/'.$this->getEnvironment();
}

// optional, to use the standard Symfony logs directory
public function getLogDir()
{
return dirname(__DIR__).'/var/logs';
return __DIR__.'/../var/logs';
}
}

Expand Down
2 changes: 1 addition & 1 deletion controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ object. To get it in your controller, just add it as an argument and

use Symfony\Component\HttpFoundation\Request;

public function indexAction($firstName, $lastName, Request $request)
public function indexAction(Request $request, $firstName, $lastName)
{
$page = $request->query->get('page', 1);

Expand Down
3 changes: 3 additions & 0 deletions form/form_dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Next, register this as a service and tag it with ``form.type``:
services:
app.form.type.task:
class: AppBundle\Form\TaskType
arguments: ['@doctrine.orm.entity_manager']
tags:
- { name: form.type }
Expand All @@ -114,6 +115,7 @@ Next, register this as a service and tag it with ``form.type``:
<services>
<service id="app.form.type.task" class="AppBundle\Form\TaskType">
<argument type="service" id="doctrine.orm.entity_manager"/>
<tag name="form.type" />
</service>
</services>
Expand All @@ -127,6 +129,7 @@ Next, register this as a service and tag it with ``form.type``:
'app.form.type.task',
'AppBundle\Form\TaskType'
)
->addArgument('@doctrine.orm.entity_manager')
->addTag('form.type')
;
Expand Down
6 changes: 3 additions & 3 deletions page_creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ to creating a page?
#. *Create a controller*: The method below the route - ``numberAction()`` - is called
the *controller*: this is a function where *you* build the page and ultimately
return a ``Response`` object. You'll learn more about :doc:`controllers </controller>`
in their own section, including how to return JSON responses;
in their own section, including how to return JSON responses.

The Web Debug Toolbar: Debugging Dream
--------------------------------------
Expand Down Expand Up @@ -134,7 +134,7 @@ variable so we can render that::
$number = mt_rand(0, 100);

return $this->render('lucky/number.html.twig', array(
'number' => $number
'number' => $number,
));
}
}
Expand Down Expand Up @@ -184,7 +184,7 @@ So what about the other directories in the project?

``var/``
This is where automatically-created files are stored, like cache files
(``var/cache/``) and logs (``var/logs/``).
(``var/cache/``), logs (``var/logs/``) and sessions (``var/sessions/``).

``vendor/``
Third-party (i.e. "vendor") libraries live here! These are downloaded via the `Composer`_
Expand Down
7 changes: 6 additions & 1 deletion reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Configuration
* :ref:`enabled <reference-serializer-enabled>`
* :ref:`cache <reference-serializer-cache>`
* :ref:`enable_annotations <reference-serializer-enable_annotations>`
* `name_converter`_
* :ref:`name_converter <reference-serializer-name_converter>`
* `php_errors`_
* `log`_
* `throw`_
Expand Down Expand Up @@ -1418,11 +1418,16 @@ If this option is enabled, serialization groups can be defined using annotations

For more information, see :ref:`serializer-using-serialization-groups-annotations`.

.. _reference-serializer-name_converter:

name_converter
..............

**type**: ``string``

.. versionadded:: 2.8
The ``name_converter`` option was introduced in Symfony 2.8.

The name converter to use.
The :class:`Symfony\\Component\\Serializer\\NameConverter\\CamelCaseToSnakeCaseNameConverter`
name converter can enabled by using the ``serializer.name_converter.camel_case_to_snake_case``
Expand Down
13 changes: 12 additions & 1 deletion reference/constraints/UniqueEntity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,18 @@ message

**type**: ``string`` **default**: ``This value is already used.``

The message that's displayed when this constraint fails.
The message that's displayed when this constraint fails. This message is always
mapped to the first field causing the violation, even when using multiple fields
in the constraint.

.. versionadded:: 3.1
The ability to include the invalid value into the message was introduced
in Symfony 3.1.

Messages can include the ``{{ value }}`` placeholder to display a string
representation of the invalid entity. If the entity doesn't define the
``__toString()`` method, the following generic value will be used: *"Object of
class __CLASS__ identified by <comma separated IDs>"*

em
~~
Expand Down
22 changes: 11 additions & 11 deletions routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Thanks to these two routes:

* If the user goes to ``/blog/*``, the second route is matched and ``showAction()``
is executed. Because the route path is ``/blog/{slug}``, a ``$slug`` variable is
passed to ``showAction`` matching that value. For example, if the user goes to
passed to ``showAction()`` matching that value. For example, if the user goes to
``/blog/yay-routing``, then ``$slug`` will equal ``yay-routing``.

Whenever you have a ``{placeholder}`` in your route path, that portion becomes a
Expand Down Expand Up @@ -363,7 +363,7 @@ With all of this in mind, check out this advanced example:
{
/**
* @Route(
* "/articles/{_locale}/{year}/{title}.{_format}",
* "/articles/{_locale}/{year}/{slug}.{_format}",
* defaults={"_format": "html"},
* requirements={
* "_locale": "en|fr",
Expand All @@ -372,7 +372,7 @@ With all of this in mind, check out this advanced example:
* }
* )
*/
public function showAction($_locale, $year, $title)
public function showAction($_locale, $year, $slug)
{
}
}
Expand All @@ -381,7 +381,7 @@ With all of this in mind, check out this advanced example:
# app/config/routing.yml
article_show:
path: /articles/{_locale}/{year}/{title}.{_format}
path: /articles/{_locale}/{year}/{slug}.{_format}
defaults: { _controller: AppBundle:Article:show, _format: html }
requirements:
_locale: en|fr
Expand All @@ -398,7 +398,7 @@ With all of this in mind, check out this advanced example:
http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="article_show"
path="/articles/{_locale}/{year}/{title}.{_format}">
path="/articles/{_locale}/{year}/{slug}.{_format}">
<default key="_controller">AppBundle:Article:show</default>
<default key="_format">html</default>
Expand All @@ -418,7 +418,7 @@ With all of this in mind, check out this advanced example:
$collection = new RouteCollection();
$collection->add(
'article_show',
new Route('/articles/{_locale}/{year}/{title}.{_format}', array(
new Route('/articles/{_locale}/{year}/{slug}.{_format}', array(
'_controller' => 'AppBundle:Article:show',
'_format' => 'html',
), array(
Expand Down Expand Up @@ -509,11 +509,11 @@ The pattern has three parts, each separated by a colon:

For example, a ``_controller`` value of ``AppBundle:Blog:show`` means:

============= ================== ==============
============= ================== ================
Bundle Controller Class Method Name
============= ================== ==============
``AppBundle`` ``BlogController`` ``showAction``
============= ================== ==============
============= ================== ================
``AppBundle`` ``BlogController`` ``showAction()``
============= ================== ================

The controller might look like this::

Expand All @@ -531,7 +531,7 @@ The controller might look like this::
}

Notice that Symfony adds the string ``Controller`` to the class name (``Blog``
=> ``BlogController``) and ``Action`` to the method name (``show`` => ``showAction``).
=> ``BlogController``) and ``Action`` to the method name (``show`` => ``showAction()``).

You could also refer to this controller using its fully-qualified class name
and method: ``AppBundle\Controller\BlogController::showAction``. But if you
Expand Down
7 changes: 5 additions & 2 deletions serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,12 @@ A service leveraging `APCu`_ (and APC for PHP < 5.5) is built-in.
Enabling a Name Converter
-------------------------

.. versionadded:: 2.8
The ``name_converter`` option was introduced in Symfony 2.8.

The use of a :ref:`name converter <component-serializer-converting-property-names-when-serializing-and-deserializing>`
service can be defined in the configuration using the ``name_converter``
serializer parameter.
service can be defined in the configuration using the :ref:`name_converter <reference-serializer-name_converter>`
option.

The built-in :ref:`CamelCase to snake_case name converter <using-camelized-method-names-for-underscored-attributes>`
can be enabled by using the ``serializer.name_converter.camel_case_to_snake_case``
Expand Down
2 changes: 1 addition & 1 deletion service_container/service_decoration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ the original service is lost:
# this replaces the old app.mailer definition with the new one, the
# old definition is lost
app.mailer:
class AppBundle\DecoratingMailer
class: AppBundle\DecoratingMailer
.. code-block:: xml
Expand Down
5 changes: 4 additions & 1 deletion setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ optional second argument of the ``new`` command:
# use the most recent 'lts' version (Long Term Support version)
$ symfony new my_project_name lts
Each version has its *own* documentation, which you can select on any documentation
page.

.. note::

Read the :doc:`Symfony Release process </contributing/community/releases>`
Expand Down Expand Up @@ -294,7 +297,7 @@ Go Deeper with Setup
.. _`Phar extension`: http://php.net/manual/en/intro.phar.php
.. _`Symfony Standard Edition`: https://github.com/symfony/symfony-standard
.. _`The Symfony Demo application`: https://github.com/symfony/symfony-demo
.. _`The Symfony CMF Standard Edition`: https://github.com/symfony-cmf/symfony-cmf-standard
.. _`The Symfony CMF Standard Edition`: https://github.com/symfony-cmf/standard-edition
.. _`Symfony CMF`: http://cmf.symfony.com/
.. _`The Symfony REST Edition`: https://github.com/gimler/symfony-rest-edition
.. _`FOSRestBundle`: https://github.com/FriendsOfSymfony/FOSRestBundle
7 changes: 7 additions & 0 deletions setup/bundles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ adding a ``setDefined()`` method. The recommended check in this case would be::
// code for the new OptionsResolver API
}

.. tip::

There is one case when you actually can rely on the
``Symfony\Component\HttpKernel\Kernel::VERSION_ID`` constant: when trying
to detect the version of the ``symfony/http-kernel`` component, because it
is the component where this constant is defined.

.. _`symfony/phpunit-bridge package`: https://github.com/symfony/phpunit-bridge
.. _`Official Symfony Guide to Upgrade from 2.x to 3.0`: https://github.com/symfony/symfony/blob/2.8/UPGRADE-3.0.md
.. _`SensioLabs DeprecationDetector`: https://github.com/sensiolabs-de/deprecation-detector
Expand Down
Loading

0 comments on commit 2b027a9

Please sign in to comment.