Skip to content

Commit 8120c70

Browse files
committed
Merge branch '2.7' into 2.8
Conflicts: form/form_dependencies.rst templating.rst
2 parents ac678c8 + 79b59a0 commit 8120c70

15 files changed

+75
-58
lines changed

best_practices/business-logic.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Inside here, you can create whatever directories you want to organize things:
1515

1616
.. code-block:: text
1717
18-
symfony2-project/
18+
symfony-project/
1919
├─ app/
2020
├─ src/
2121
│ └─ AppBundle/
@@ -33,7 +33,7 @@ and put things there:
3333

3434
.. code-block:: text
3535
36-
symfony2-project/
36+
symfony-project/
3737
├─ app/
3838
├─ src/
3939
│ ├─ Acme/
@@ -176,7 +176,7 @@ The three entities defined by our sample blog application are a good example:
176176

177177
.. code-block:: text
178178
179-
symfony2-project/
179+
symfony-project/
180180
├─ ...
181181
└─ src/
182182
└─ AppBundle/

best_practices/controllers.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ it more difficult to know which template is being rendered. It also makes
8585
it less obvious to beginners that a controller should always return a Response
8686
object (unless you're using a view layer).
8787

88-
How the Controller Looks
89-
------------------------
88+
What does the Controller look like
89+
----------------------------------
9090

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

9494
.. code-block:: php

components/expression_language.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ How can the Expression Engine Help Me?
2121
--------------------------------------
2222

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

2727
Besides using the component in the framework itself, the ExpressionLanguage

components/filesystem.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ On POSIX filesystems, directories are created with a default mode value
6464
You can pass an array or any :phpclass:`Traversable` object as the first
6565
argument.
6666

67+
.. note::
68+
69+
This function ignores already existing directories.
70+
6771
exists
6872
~~~~~~
6973

components/yaml/yaml_format.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ YAML uses the ISO-8601 standard to express dates:
158158

159159
.. code-block:: yaml
160160
161-
2001-12-14t21:59:43.10-05:00
161+
2001-12-14T21:59:43.10-05:00
162162
163163
.. code-block:: yaml
164164

configuration.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ There are *two* ways to know *what* keys you can configure:
112112

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

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

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

120120
.. code-block:: terminal
121121
122-
$ php app/console config:dump twig
122+
$ php app/console config:dump-reference twig
123123
124124
.. index::
125125
single: Environments; Introduction
@@ -183,7 +183,7 @@ can also load XML files or PHP files.
183183

184184
.. _config-parameter-intro:
185185

186-
The parameters key: Parameters (Variables)
186+
The parameters Key: Parameters (Variables)
187187
------------------------------------------
188188

189189
Another special key is called ``parameters``: it's used to define *variables* that

controller.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ object. To get it in your controller, just add it as an argument and
328328

329329
use Symfony\Component\HttpFoundation\Request;
330330

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

form/form_dependencies.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ Next, register this as a service and tag it with ``form.type``:
101101
services:
102102
app.form.type.task:
103103
class: AppBundle\Form\TaskType
104+
arguments: ['@doctrine.orm.entity_manager']
104105
tags:
105106
- { name: form.type }
106107
@@ -114,6 +115,7 @@ Next, register this as a service and tag it with ``form.type``:
114115
115116
<services>
116117
<service id="app.form.type.task" class="AppBundle\Form\TaskType">
118+
<argument type="service" id="doctrine.orm.entity_manager"/>
117119
<tag name="form.type" />
118120
</service>
119121
</services>
@@ -127,6 +129,7 @@ Next, register this as a service and tag it with ``form.type``:
127129
'app.form.type.task',
128130
'AppBundle\Form\TaskType'
129131
)
132+
->addArgument('@doctrine.orm.entity_manager')
130133
->addTag('form.type')
131134
;
132135

page_creation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ to creating a page?
8181
#. *Create a controller*: The method below the route - ``numberAction()`` - is called
8282
the *controller*: this is a function where *you* build the page and ultimately
8383
return a ``Response`` object. You'll learn more about :doc:`controllers </controller>`
84-
in their own section, including how to return JSON responses;
84+
in their own section, including how to return JSON responses.
8585

8686
The Web Debug Toolbar: Debugging Dream
8787
--------------------------------------
@@ -129,7 +129,7 @@ variable so we can render that::
129129
$number = mt_rand(0, 100);
130130

131131
return $this->render('lucky/number.html.twig', array(
132-
'number' => $number
132+
'number' => $number,
133133
));
134134
}
135135
}

routing.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Thanks to these two routes:
120120

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

126126
Whenever you have a ``{placeholder}`` in your route path, that portion becomes a
@@ -363,7 +363,7 @@ With all of this in mind, check out this advanced example:
363363
{
364364
/**
365365
* @Route(
366-
* "/articles/{_locale}/{year}/{title}.{_format}",
366+
* "/articles/{_locale}/{year}/{slug}.{_format}",
367367
* defaults={"_format": "html"},
368368
* requirements={
369369
* "_locale": "en|fr",
@@ -372,7 +372,7 @@ With all of this in mind, check out this advanced example:
372372
* }
373373
* )
374374
*/
375-
public function showAction($_locale, $year, $title)
375+
public function showAction($_locale, $year, $slug)
376376
{
377377
}
378378
}
@@ -381,7 +381,7 @@ With all of this in mind, check out this advanced example:
381381
382382
# app/config/routing.yml
383383
article_show:
384-
path: /articles/{_locale}/{year}/{title}.{_format}
384+
path: /articles/{_locale}/{year}/{slug}.{_format}
385385
defaults: { _controller: AppBundle:Article:show, _format: html }
386386
requirements:
387387
_locale: en|fr
@@ -398,7 +398,7 @@ With all of this in mind, check out this advanced example:
398398
http://symfony.com/schema/routing/routing-1.0.xsd">
399399
400400
<route id="article_show"
401-
path="/articles/{_locale}/{year}/{title}.{_format}">
401+
path="/articles/{_locale}/{year}/{slug}.{_format}">
402402
403403
<default key="_controller">AppBundle:Article:show</default>
404404
<default key="_format">html</default>
@@ -418,7 +418,7 @@ With all of this in mind, check out this advanced example:
418418
$collection = new RouteCollection();
419419
$collection->add(
420420
'article_show',
421-
new Route('/articles/{_locale}/{year}/{title}.{_format}', array(
421+
new Route('/articles/{_locale}/{year}/{slug}.{_format}', array(
422422
'_controller' => 'AppBundle:Article:show',
423423
'_format' => 'html',
424424
), array(
@@ -502,11 +502,11 @@ The pattern has three parts, each separated by a colon:
502502

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

505-
============= ================== ==============
505+
============= ================== ================
506506
Bundle Controller Class Method Name
507-
============= ================== ==============
508-
``AppBundle`` ``BlogController`` ``showAction``
509-
============= ================== ==============
507+
============= ================== ================
508+
``AppBundle`` ``BlogController`` ``showAction()``
509+
============= ================== ================
510510

511511
The controller might look like this::
512512

@@ -524,7 +524,7 @@ The controller might look like this::
524524
}
525525

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

529529
You could also refer to this controller using its fully-qualified class name
530530
and method: ``AppBundle\Controller\BlogController::showAction``. But if you

service_container/service_decoration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ the original service is lost:
1818
# this replaces the old app.mailer definition with the new one, the
1919
# old definition is lost
2020
app.mailer:
21-
class AppBundle\DecoratingMailer
21+
class: AppBundle\DecoratingMailer
2222
2323
.. code-block:: xml
2424

setup.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ optional second argument of the ``new`` command:
9191
# use the most recent 'lts' version (Long Term Support version)
9292
$ symfony new my_project_name lts
9393
94+
Each version has its *own* documentation, which you can select on any documentation
95+
page.
96+
9497
.. note::
9598

9699
Read the :doc:`Symfony Release process </contributing/community/releases>`
@@ -288,7 +291,7 @@ Go Deeper with Setup
288291
.. _`Phar extension`: http://php.net/manual/en/intro.phar.php
289292
.. _`Symfony Standard Edition`: https://github.com/symfony/symfony-standard
290293
.. _`The Symfony Demo application`: https://github.com/symfony/symfony-demo
291-
.. _`The Symfony CMF Standard Edition`: https://github.com/symfony-cmf/symfony-cmf-standard
294+
.. _`The Symfony CMF Standard Edition`: https://github.com/symfony-cmf/standard-edition
292295
.. _`Symfony CMF`: http://cmf.symfony.com/
293296
.. _`The Symfony REST Edition`: https://github.com/gimler/symfony-rest-edition
294297
.. _`FOSRestBundle`: https://github.com/FriendsOfSymfony/FOSRestBundle

setup/bundles.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,13 @@ adding a ``setDefined()`` method. The recommended check in this case would be::
189189
// code for the new OptionsResolver API
190190
}
191191

192+
.. tip::
193+
194+
There is one case when you actually can rely on the
195+
``Symfony\Component\HttpKernel\Kernel::VERSION_ID`` constant: when trying
196+
to detect the version of the ``symfony/http-kernel`` component, because it
197+
is the component where this constant is defined.
198+
192199
.. _`symfony/phpunit-bridge package`: https://github.com/symfony/phpunit-bridge
193200
.. _`Official Symfony Guide to Upgrade from 2.x to 3.0`: https://github.com/symfony/symfony/blob/2.8/UPGRADE-3.0.md
194201
.. _`SensioLabs DeprecationDetector`: https://github.com/sensiolabs-de/deprecation-detector

templating.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -575,10 +575,10 @@ Creating links to other pages in your application is one of the most common
575575
jobs for a template. Instead of hardcoding URLs in templates, use the ``path``
576576
Twig function (or the ``router`` helper in PHP) to generate URLs based on
577577
the routing configuration. Later, if you want to modify the URL of a particular
578-
page, all you'll need to do is change the routing configuration; the templates
578+
page, all you'll need to do is change the routing configuration: the templates
579579
will automatically generate the new URL.
580580

581-
First, link to the "_welcome" page, which is accessible via the following routing
581+
First, link to the "welcome" page, which is accessible via the following routing
582582
configuration:
583583

584584
.. configuration-block::
@@ -593,7 +593,7 @@ configuration:
593593
class WelcomeController extends Controller
594594
{
595595
/**
596-
* @Route("/", name="_welcome")
596+
* @Route("/", name="welcome")
597597
*/
598598
public function indexAction()
599599
{
@@ -604,7 +604,7 @@ configuration:
604604
.. code-block:: yaml
605605
606606
# app/config/routing.yml
607-
_welcome:
607+
welcome:
608608
path: /
609609
defaults: { _controller: AppBundle:Welcome:index }
610610
@@ -617,7 +617,7 @@ configuration:
617617
xsi:schemaLocation="http://symfony.com/schema/routing
618618
http://symfony.com/schema/routing/routing-1.0.xsd">
619619
620-
<route id="_welcome" path="/">
620+
<route id="welcome" path="/">
621621
<default key="_controller">AppBundle:Welcome:index</default>
622622
</route>
623623
</routes>
@@ -629,7 +629,7 @@ configuration:
629629
use Symfony\Component\Routing\RouteCollection;
630630
631631
$collection = new RouteCollection();
632-
$collection->add('_welcome', new Route('/', array(
632+
$collection->add('welcome', new Route('/', array(
633633
'_controller' => 'AppBundle:Welcome:index',
634634
)));
635635
@@ -641,11 +641,11 @@ To link to the page, just use the ``path`` Twig function and refer to the route:
641641

642642
.. code-block:: html+twig
643643

644-
<a href="{{ path('_welcome') }}">Home</a>
644+
<a href="{{ path('welcome') }}">Home</a>
645645

646646
.. code-block:: html+php
647647

648-
<a href="<?php echo $view['router']->path('_welcome') ?>">Home</a>
648+
<a href="<?php echo $view['router']->path('welcome') ?>">Home</a>
649649

650650
.. versionadded:: 2.8
651651
The ``path()`` PHP templating helper was introduced in Symfony 2.8. Prior
@@ -710,7 +710,7 @@ route:
710710
711711
In this case, you need to specify both the route name (``article_show``) and
712712
a value for the ``{slug}`` parameter. Using this route, revisit the
713-
``recent_list`` template from the previous section and link to the articles
713+
``recent_list.html.twig`` template from the previous section and link to the articles
714714
correctly:
715715

716716
.. configuration-block::
@@ -743,12 +743,12 @@ correctly:
743743

744744
.. code-block:: html+twig
745745

746-
<a href="{{ url('_welcome') }}">Home</a>
746+
<a href="{{ url('welcome') }}">Home</a>
747747

748748
.. code-block:: html+php
749749

750750
<a href="<?php echo $view['router']->url(
751-
'_welcome',
751+
'welcome',
752752
array()
753753
) ?>">Home</a>
754754

@@ -909,14 +909,14 @@ block of the base template.
909909

910910
You can also include assets located in your bundles' ``Resources/public`` folder.
911911
You will need to run the ``php app/console assets:install target [--symlink]``
912-
command, which moves (or symlinks) files into the correct location. (target
912+
command, which copies (or symlinks) files into the correct location. (target
913913
is by default "web").
914914

915915
.. code-block:: html+twig
916916

917917
<link href="{{ asset('bundles/acmedemo/css/contact.css') }}" rel="stylesheet" />
918918

919-
The end result is a page that includes both the ``main.css`` and ``contact.css``
919+
The end result is a page that includes ``main.js`` and both the ``main.css`` and ``contact.css``
920920
stylesheets.
921921

922922
Referencing the Request, User or Session
@@ -938,7 +938,7 @@ Suppose ``description`` equals ``I <3 this product``:
938938
.. code-block:: twig
939939
940940
<!-- output escaping is on automatically -->
941-
{{ description }} <!-- I &lt3 this product -->
941+
{{ description }} <!-- I &lt;3 this product -->
942942
943943
<!-- disable output escaping with the raw filter -->
944944
{{ description|raw }} <!-- I <3 this product -->

0 commit comments

Comments
 (0)