Skip to content

Commit 5a361ee

Browse files
committed
Merge branch '2.7' into 2.8
2 parents f965e3a + 130e55b commit 5a361ee

34 files changed

+583
-177
lines changed

book/doctrine.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,10 @@ Take a look at the previous example in more detail:
534534
responsible for handling the process of persisting and fetching objects
535535
to and from the database.
536536

537-
* **line 16** The ``persist()`` method tells Doctrine to "manage" the ``$product``
537+
* **line 17** The ``persist()`` method tells Doctrine to "manage" the ``$product``
538538
object. This does not actually cause a query to be made to the database (yet).
539539

540-
* **line 17** When the ``flush()`` method is called, Doctrine looks through
540+
* **line 18** When the ``flush()`` method is called, Doctrine looks through
541541
all of the objects that it's managing to see if they need to be persisted
542542
to the database. In this example, the ``$product`` object has not been
543543
persisted yet, so the entity manager executes an ``INSERT`` query and a

book/routing.rst

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,25 +1473,14 @@ route. With this information, any URL can easily be generated::
14731473

14741474
.. note::
14751475

1476-
In controllers that don't extend Symfony's base
1477-
:class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller`,
1478-
you can use the ``router`` service's
1479-
:method:`Symfony\\Component\\Routing\\Router::generate` method::
1476+
The ``generateUrl()`` method defined in the base
1477+
:class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller` class is
1478+
just a shortcut for this code::
14801479

1481-
use Symfony\Component\DependencyInjection\ContainerAware;
1482-
1483-
class MainController extends ContainerAware
1484-
{
1485-
public function showAction($slug)
1486-
{
1487-
// ...
1488-
1489-
$url = $this->container->get('router')->generate(
1490-
'blog_show',
1491-
array('slug' => 'my-blog-post')
1492-
);
1493-
}
1494-
}
1480+
$url = $this->container->get('router')->generate(
1481+
'blog_show',
1482+
array('slug' => 'my-blog-post')
1483+
);
14951484

14961485
In an upcoming section, you'll learn how to generate URLs from inside templates.
14971486

book/service_container.rst

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,10 @@ The service container is built using a single configuration resource
276276
be imported from inside this file in one way or another. This gives you absolute
277277
flexibility over the services in your application.
278278

279-
External service configuration can be imported in two different ways. The first
280-
method, commonly used to import container configuration from the bundles you've
281-
created - is via the ``imports`` directive. The second method, although slightly more
282-
complex offers more flexibility and is commonly used to import third-party bundle
279+
External service configuration can be imported in two different ways. The first
280+
method, commonly used to import container configuration from the bundles you've
281+
created - is via the ``imports`` directive. The second method, although slightly more
282+
complex offers more flexibility and is commonly used to import third-party bundle
283283
configuration. Read on to learn more about both methods.
284284

285285
.. index::
@@ -1104,13 +1104,15 @@ to be used for a specific purpose. Take the following example:
11041104
xsi:schemaLocation="http://symfony.com/schema/dic/services
11051105
http://symfony.com/schema/dic/services/services-1.0.xsd">
11061106
1107-
<service
1108-
id="foo.twig.extension"
1109-
class="Acme\HelloBundle\Extension\FooExtension"
1110-
public="false">
1107+
<services>
1108+
<service
1109+
id="foo.twig.extension"
1110+
class="Acme\HelloBundle\Extension\FooExtension"
1111+
public="false">
11111112
1112-
<tag name="twig.extension" />
1113-
</service>
1113+
<tag name="twig.extension" />
1114+
</service>
1115+
</services>
11141116
</container>
11151117
11161118
.. code-block:: php

book/templating.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ if you are using Twig (or the third argument if you are using PHP) to ``true``:
10981098

10991099
.. code-block:: html+jinja
11001100

1101-
<img src="{{ asset('images/logo.png', absolute=true) }}" alt="Symfony!" />
1101+
<img src="{{ absolute_url(asset('images/logo.png')) }}" alt="Symfony!" />
11021102

11031103
.. code-block:: html+php
11041104

components/console/helpers/debug_formatter.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Stopping a Program
117117
------------------
118118

119119
When a program is stopped, you can use
120-
:method:`Symfony\\Component\\Console\\Helper\\DebugFormatterHelper::run` to
120+
:method:`Symfony\\Component\\Console\\Helper\\DebugFormatterHelper::stop` to
121121
notify this to the users::
122122

123123
// ...

components/console/helpers/table.rst

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,94 @@ Here is a full list of things you can customize:
143143
$table->setStyle('colorful');
144144

145145
This method can also be used to override a built-in style.
146+
147+
Spanning Multiple Columns and Rows
148+
----------------------------------
149+
150+
.. versionadded:: 2.7
151+
Spanning multiple columns and rows was introduced in Symfony 2.7.
152+
153+
To make a table cell that spans multiple columns you can use a :class:`Symfony\\Component\\Console\\Helper\\TableCell`::
154+
155+
use Symfony\Component\Console\Helper\Table;
156+
use Symfony\Component\Console\Helper\TableSeparator;
157+
use Symfony\Component\Console\Helper\TableCell;
158+
159+
$table = new Table($output);
160+
$table
161+
->setHeaders(array('ISBN', 'Title', 'Author'))
162+
->setRows(array(
163+
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
164+
new TableSeparator(),
165+
array(new TableCell('This value spans 3 columns.', array('colspan' => 3))),
166+
))
167+
;
168+
$table->render();
169+
170+
This results in:
171+
172+
.. code-block:: text
173+
174+
+---------------+---------------+-----------------+
175+
| ISBN | Title | Author |
176+
+---------------+---------------+-----------------+
177+
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
178+
+---------------+---------------+-----------------+
179+
| This value spans 3 columns. |
180+
+---------------+---------------+-----------------+
181+
182+
.. tip::
183+
184+
You can create a multiple-line page title using a header cell that spans
185+
the enire table width::
186+
187+
$table->setHeaders(array(
188+
array(new TableCell('Main table title', array('colspan' => 3))),
189+
array('ISBN', 'Title', 'Author'),
190+
))
191+
// ...
192+
193+
This generates:
194+
195+
.. code-block:: text
196+
197+
+-------+-------+--------+
198+
| Main table title |
199+
+-------+-------+--------+
200+
| ISBN | Title | Author |
201+
+-------+-------+--------+
202+
| ... |
203+
+-------+-------+--------+
204+
205+
In a similar way you can span multiple rows::
206+
207+
use Symfony\Component\Console\Helper\Table;
208+
use Symfony\Component\Console\Helper\TableCell;
209+
210+
$table = new Table($output);
211+
$table
212+
->setHeaders(array('ISBN', 'Title', 'Author'))
213+
->setRows(array(
214+
array(
215+
'978-0521567817',
216+
'De Monarchia',
217+
new TableCell("Dante Alighieri\nspans multiple rows", array('rowspan' => 2)),
218+
),
219+
array('978-0804169127', 'Divine Comedy'),
220+
))
221+
;
222+
$table->render();
223+
224+
This outputs:
225+
226+
.. code-block:: text
227+
228+
+----------------+---------------+---------------------+
229+
| ISBN | Title | Author |
230+
+----------------+---------------+---------------------+
231+
| 978-0521567817 | De Monarchia | Dante Alighieri |
232+
| 978-0804169127 | Divine Comedy | spans multiple rows |
233+
+----------------+---------------+---------------------+
234+
235+
You can use the ``colspan`` and ``rowspan`` options at the same time which allows
236+
you to create any table layout you may wish.

contributing/code/security.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ Security Advisories
103103
This section indexes security vulnerabilities that were fixed in Symfony
104104
releases, starting from Symfony 1.0.0:
105105

106+
* November 23, 2015: `CVE-2015-8125: Potential Remote Timing Attack Vulnerability in Security Remember-Me Service <http://symfony.com/blog/cve-2015-8125-potential-remote-timing-attack-vulnerability-in-security-remember-me-service>`_ (2.3.35, 2.6.12 and 2.7.7)
107+
* November 23, 2015: `CVE-2015-8124: Session Fixation in the "Remember Me" Login Feature <http://symfony.com/blog/cve-2015-8124-session-fixation-in-the-remember-me-login-feature>`_ (2.3.35, 2.6.12 and 2.7.7)
106108
* May 26, 2015: `CVE-2015-4050: ESI unauthorized access <https://symfony.com/blog/cve-2015-4050-esi-unauthorized-access>`_ (Symfony 2.3.29, 2.5.12 and 2.6.8)
107109
* April 1, 2015: `CVE-2015-2309: Unsafe methods in the Request class <https://symfony.com/blog/cve-2015-2309-unsafe-methods-in-the-request-class>`_ (Symfony 2.3.27, 2.5.11 and 2.6.6)
108110
* April 1, 2015: `CVE-2015-2308: Esi Code Injection <https://symfony.com/blog/cve-2015-2308-esi-code-injection>`_ (Symfony 2.3.27, 2.5.11 and 2.6.6)

cookbook/configuration/override_dir_structure.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@ The change in the ``composer.json`` will look like this:
176176
...
177177
}
178178
179-
In ``app/autoload.php``, you need to modify the path leading to the
180-
``vendor/autoload.php`` file::
179+
Then, update the path to the ``autoload.php`` file in ``app/autoload.php``::
181180

182181
// app/autoload.php
183182
// ...

cookbook/doctrine/event_listeners_subscribers.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,14 @@ a ``postPersist`` method, which will be called when the event is dispatched::
135135
public function postPersist(LifecycleEventArgs $args)
136136
{
137137
$entity = $args->getEntity();
138-
$entityManager = $args->getEntityManager();
139138

140-
// perhaps you only want to act on some "Product" entity
141-
if ($entity instanceof Product) {
142-
// ... do something with the Product
139+
// only act on some "Product" entity
140+
if (!$entity instanceof Product) {
141+
return;
143142
}
143+
144+
$entityManager = $args->getEntityManager();
145+
// ... do something with the Product
144146
}
145147
}
146148

@@ -197,10 +199,10 @@ interface and have an event method for each event it subscribes to::
197199
public function index(LifecycleEventArgs $args)
198200
{
199201
$entity = $args->getEntity();
200-
$entityManager = $args->getEntityManager();
201202

202203
// perhaps you only want to act on some "Product" entity
203204
if ($entity instanceof Product) {
205+
$entityManager = $args->getEntityManager();
204206
// ... do something with the Product
205207
}
206208
}

cookbook/form/dynamic_form_modification.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -411,25 +411,26 @@ it with :ref:`dic-tags-form-type`.
411411
array('security.token_storage')
412412
);
413413
414-
If you wish to create it from within a controller or any other service that has
415-
access to the form factory, you then use::
414+
If you wish to create it from within a service that has access to the form factory,
415+
you then use::
416416

417-
use Symfony\Component\DependencyInjection\ContainerAware;
417+
$form = $formFactory->create('friend_message');
418418

419-
class FriendMessageController extends ContainerAware
419+
In a controller that extends the :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller`
420+
class, you can simply call::
421+
422+
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
423+
424+
class FriendMessageController extends Controller
420425
{
421426
public function newAction(Request $request)
422427
{
423-
$form = $this->get('form.factory')->create('friend_message');
428+
$form = $this->createForm('friend_message');
424429

425430
// ...
426431
}
427432
}
428433

429-
If you extend the ``Symfony\Bundle\FrameworkBundle\Controller\Controller`` class, you can simply call::
430-
431-
$form = $this->createForm('friend_message');
432-
433434
You can also easily embed the form type into another form::
434435

435436
// inside some other "form type" class

0 commit comments

Comments
 (0)