Skip to content

Commit fcb4233

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: (31 commits) Removing old :term: stuff Replacing missing link Fixing typo Final changes [WIP] More changes [WIP] More changes [WIP] Removing multiple formats - it makes no sense here [WIP] More changes [WIP] Reading through the changes changes according to comments after PR + some other typos typo fix in hyperlink typo fix in hyperlink colon corrections made some new changes, corrected mistakes, undo some foolish deletions [] changes in the first four ch of the book [#6656] Fix syntax to comply with docs standards Clarify usage of handler channel configuration replace occurrences of <?php echo with <?= Improve comment If context is defined, it is used instead of the firewall ...
2 parents 6680621 + b5e3d15 commit fcb4233

File tree

9 files changed

+48
-41
lines changed

9 files changed

+48
-41
lines changed

book/from_flat_php_to_symfony2.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ persisted to the database. Writing in flat PHP is quick and dirty:
4848
<ul>
4949
<?php while ($row = $result->fetch(PDO::FETCH_ASSOC)): ?>
5050
<li>
51-
<a href="/show.php?id=<?php echo $row['id'] ?>">
52-
<?php echo $row['title'] ?>
51+
<a href="/show.php?id=<?= $row['id'] ?>">
52+
<?= $row['title'] ?>
5353
</a>
5454
</li>
5555
<?php endwhile ?>
@@ -118,8 +118,8 @@ is primarily an HTML file that uses a template-like PHP syntax:
118118
<ul>
119119
<?php foreach ($posts as $post): ?>
120120
<li>
121-
<a href="/show.php?id=<?php echo $post['id'] ?>">
122-
<?php echo $post['title'] ?>
121+
<a href="/show.php?id=<?= $post['id'] ?>">
122+
<?= $post['title'] ?>
123123
</a>
124124
</li>
125125
<?php endforeach ?>
@@ -211,10 +211,10 @@ that by creating a new ``templates/layout.php`` file:
211211
<!DOCTYPE html>
212212
<html>
213213
<head>
214-
<title><?php echo $title ?></title>
214+
<title><?= $title ?></title>
215215
</head>
216216
<body>
217-
<?php echo $content ?>
217+
<?= $content ?>
218218
</body>
219219
</html>
220220

@@ -231,8 +231,8 @@ the ``templates/layout.php``:
231231
<ul>
232232
<?php foreach ($posts as $post): ?>
233233
<li>
234-
<a href="/show.php?id=<?php echo $post['id'] ?>">
235-
<?php echo $post['title'] ?>
234+
<a href="/show.php?id=<?= $post['id'] ?>">
235+
<?= $post['title'] ?>
236236
</a>
237237
</li>
238238
<?php endforeach ?>
@@ -294,11 +294,11 @@ the individual blog post:
294294
<?php $title = $post['title'] ?>
295295

296296
<?php ob_start() ?>
297-
<h1><?php echo $post['title'] ?></h1>
297+
<h1><?= $post['title'] ?></h1>
298298

299-
<div class="date"><?php echo $post['created_at'] ?></div>
299+
<div class="date"><?= $post['created_at'] ?></div>
300300
<div class="body">
301-
<?php echo $post['body'] ?>
301+
<?= $post['body'] ?>
302302
</div>
303303
<?php $content = ob_get_clean() ?>
304304

@@ -601,7 +601,7 @@ database and the Templating component to render a template and return a
601601
'blog_show',
602602
array('id' => $post->getId())
603603
) ?>">
604-
<?php echo $post->getTitle() ?>
604+
<?= $post->getTitle() ?>
605605
</a>
606606
</li>
607607
<?php endforeach ?>
@@ -615,13 +615,13 @@ The ``layout.php`` file is nearly identical:
615615
<!DOCTYPE html>
616616
<html>
617617
<head>
618-
<title><?php echo $view['slots']->output(
618+
<title><?= $view['slots']->output(
619619
'title',
620620
'Default title'
621621
) ?></title>
622622
</head>
623623
<body>
624-
<?php echo $view['slots']->output('_content') ?>
624+
<?= $view['slots']->output('_content') ?>
625625
</body>
626626
</html>
627627

book/routing.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,11 +1169,11 @@ each separated by a colon:
11691169

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

1172-
========= ================== ==============
1173-
Bundle Controller Class Method Name
1174-
========= ================== ==============
1175-
AppBundle ``BlogController`` ``showAction``
1176-
========= ================== ==============
1172+
============= ================== ==============
1173+
Bundle Controller Class Method Name
1174+
============= ================== ==============
1175+
``AppBundle`` ``BlogController`` ``showAction``
1176+
============= ================== ==============
11771177

11781178
The controller might look like this::
11791179

@@ -1507,7 +1507,7 @@ In an upcoming section, you'll learn how to generate URLs from inside templates.
15071507
15081508
var url = Routing.generate(
15091509
'blog_show',
1510-
{"slug": 'my-blog-post'}
1510+
{'slug': 'my-blog-post'}
15111511
);
15121512
15131513
For more information, see the documentation for that bundle.
@@ -1532,7 +1532,7 @@ Generating URLs from a Template
15321532

15331533
The most common place to generate a URL is from within a template when linking
15341534
between pages in your application. This is done just as before, but using
1535-
a template helper function:
1535+
the ``path()`` function to generate a relative URL:
15361536

15371537
.. configuration-block::
15381538

book/testing.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ document::
263263
$client->getResponse()->headers->contains(
264264
'Content-Type',
265265
'application/json'
266-
)
266+
),
267+
'the "Content-Type" header is "application/json"' // optional message shown on failure
267268
);
268269

269270
// Assert that the response content contains a string
@@ -272,7 +273,7 @@ document::
272273
$this->assertRegExp('/foo(bar)?/', $client->getResponse()->getContent());
273274

274275
// Assert that the response status code is 2xx
275-
$this->assertTrue($client->getResponse()->isSuccessful());
276+
$this->assertTrue($client->getResponse()->isSuccessful(), 'response status is 2xx');
276277
// Assert that the response status code is 404
277278
$this->assertTrue($client->getResponse()->isNotFound());
278279
// Assert a specific 200 status code
@@ -283,7 +284,8 @@ document::
283284

284285
// Assert that the response is a redirect to /demo/contact
285286
$this->assertTrue(
286-
$client->getResponse()->isRedirect('/demo/contact')
287+
$client->getResponse()->isRedirect('/demo/contact'),
288+
'response is a redirect to /demo/contact'
287289
);
288290
// ...or simply check that the response is a redirect to any URL
289291
$this->assertTrue($client->getResponse()->isRedirect());

components/dependency_injection/lazy_services.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@ the `ProxyManager bridge`_:
3535
.. note::
3636

3737
If you're using the full-stack framework, the proxy manager bridge is
38-
already included but the actual proxy manager needs to be included.
39-
So, run:
38+
already included but the actual proxy manager still needs to be installed:
4039

4140
.. code-block:: bash
42-
43-
$ composer require ocramius/proxy-manager:~1.0
41+
42+
$ composer require ocramius/proxy-manager
4443
4544
Afterwards compile your container and check to make sure that you get
4645
a proxy for your lazy services.

contributing/code/standards.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ Structure
173173

174174
* Calls to :phpfunction:`trigger_error` with type ``E_USER_DEPRECATED`` must be
175175
switched to opt-in via ``@`` operator.
176-
Read more at :ref:`contributing-code-conventions-deprecations`.
176+
Read more at :ref:`contributing-code-conventions-deprecations`;
177177

178178
* Do not use ``else``, ``elseif``, ``break`` after ``if`` and ``case`` conditions
179179
which return or throw something.

cookbook/controller/service.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ the route ``_controller`` value:
119119
.. tip::
120120

121121
You can also use annotations to configure routing using a controller
122-
defined as a service. See the `FrameworkExtraBundle documentation`_ for
122+
defined as a service. Make sure you specify the service ID in the
123+
``@Route`` annotation. See the `FrameworkExtraBundle documentation`_ for
123124
details.
124125

125126
.. tip::
@@ -335,4 +336,4 @@ controller:
335336

336337
.. _`Controller class source code`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php
337338
.. _`base Controller class`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php
338-
.. _`FrameworkExtraBundle documentation`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/routing.html
339+
.. _`FrameworkExtraBundle documentation`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/routing.html#controller-as-service

cookbook/logging/channels_handlers.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ in all environments, or just ``config_prod.yml`` to happen only in ``prod``:
9595
),
9696
));
9797
98+
.. caution::
99+
100+
The ``channels`` configuration only works for top level handlers. Handlers
101+
that are nested inside a group, buffer, filter, fingers crossed or other
102+
such handler will ignore this configuration and will process every message
103+
passed to them.
104+
98105
YAML Specification
99106
------------------
100107

cookbook/routing/method_parameters.rst

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,6 @@ delete it by matching on GET, PUT and DELETE.
7474
Faking the Method with ``_method``
7575
----------------------------------
7676

77-
.. note::
78-
79-
The ``_method`` functionality shown here is disabled by default in Symfony 2.2
80-
and enabled by default in Symfony 2.3. To control it in Symfony 2.2, you
81-
must call :method:`Request::enableHttpMethodParameterOverride <Symfony\\Component\\HttpFoundation\\Request::enableHttpMethodParameterOverride>`
82-
before you handle the request (e.g. in your front controller). In Symfony
83-
2.3, use the :ref:`configuration-framework-http_method_override` option.
84-
8577
Unfortunately, life isn't quite this simple, since most browsers do not support
8678
sending PUT and DELETE requests via the `method` attribute in an HTML form. Fortunately,
8779
Symfony provides you with a simple way of working around this limitation. By including
@@ -90,3 +82,8 @@ will use this as the method when matching routes. Forms automatically include a
9082
hidden field for this parameter if their submission method is not GET or POST.
9183
See :ref:`the related chapter in the forms documentation<book-forms-changing-action-and-method>`
9284
for more information.
85+
86+
.. tip::
87+
88+
You can disable the ``_method`` functionality shown here using the
89+
:ref:`configuration-framework-http_method_override` option.

cookbook/testing/simulating_authentication.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ It could become an issue especially when ``form_login`` is used, since
99
it requires additional requests to fill in and submit the form.
1010

1111
One of the solutions is to configure your firewall to use ``http_basic`` in
12-
the test environment as explained in
13-
:doc:`/cookbook/testing/http_authentication`.
12+
the test environment as explained in :doc:`/cookbook/testing/http_authentication`.
1413
Another way would be to create a token yourself and store it in a session.
1514
While doing this, you have to make sure that an appropriate cookie is sent
1615
with a request. The following example demonstrates this technique::
@@ -45,7 +44,9 @@ with a request. The following example demonstrates this technique::
4544
{
4645
$session = $this->client->getContainer()->get('session');
4746

47+
// the firewall context (defaults to the firewall name)
4848
$firewall = 'secured_area';
49+
4950
$token = new UsernamePasswordToken('admin', null, $firewall, array('ROLE_ADMIN'));
5051
$session->set('_security_'.$firewall, serialize($token));
5152
$session->save();

0 commit comments

Comments
 (0)