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

cookbook/security/form_login_setup.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ In this entry, you'll build a traditional login form. Of course, when the
1212
user logs in, you can load your users from anywhere - like the database.
1313
See :ref:`security-user-providers` for details.
1414

15-
This chapter assumes that you've followed the beginning of the
16-
:doc:`security chapter </book/security>` and have ``http_basic`` authentication
17-
working properly.
18-
1915
First, enable form login under your firewall:
2016

2117
.. configuration-block::
@@ -29,7 +25,6 @@ First, enable form login under your firewall:
2925
firewalls:
3026
default:
3127
anonymous: ~
32-
http_basic: ~
3328
form_login:
3429
login_path: /login
3530
check_path: /login_check
@@ -47,7 +42,6 @@ First, enable form login under your firewall:
4742
<config>
4843
<firewall name="default">
4944
<anonymous />
50-
<http-basic />
5145
<form-login login-path="/login" check-path="/login_check" />
5246
</firewall>
5347
</config>
@@ -60,7 +54,6 @@ First, enable form login under your firewall:
6054
'firewalls' => array(
6155
'default' => array(
6256
'anonymous' => null,
63-
'http_basic' => null,
6457
'form_login' => array(
6558
'login_path' => '/login',
6659
'check_path' => '/login_check',

create_framework/dependency-injection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ them. Objects will be created on-demand when you access them from the
132132
container or when the container needs them to create other objects.
133133

134134
For instance, to create the router listener, we tell Symfony that its class
135-
name is ``Symfony\Component\HttpKernel\EventListener\RouterListener``, and
135+
name is ``Symfony\Component\HttpKernel\EventListener\RouterListener`` and
136136
that its constructor takes a matcher object (``new Reference('matcher')``). As
137137
you can see, each object is referenced by a name, a string that uniquely
138138
identifies each object. The name allows us to get an object and to reference

create_framework/event-dispatcher.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ event (``response``); the event name must be the same as the one used in the
154154
``dispatch()`` call.
155155

156156
In the listener, we add the Google Analytics code only if the response is not
157-
a redirection, if the requested format is HTML, and if the response content
157+
a redirection, if the requested format is HTML and if the response content
158158
type is HTML (these conditions demonstrate the ease of manipulating the
159159
Request and Response data from your code).
160160

create_framework/front-controller.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ And for the "Goodbye" page::
5757

5858
We have indeed moved most of the shared code into a central place, but it does
5959
not feel like a good abstraction, does it? We still have the ``send()`` method
60-
for all pages, our pages do not look like templates, and we are still not able
60+
for all pages, our pages do not look like templates and we are still not able
6161
to test this code properly.
6262

6363
Moreover, adding a new page means that we need to create a new PHP script,
@@ -159,7 +159,7 @@ web root directory:
159159
Now, configure your web server root directory to point to ``web/`` and all
160160
other files won't be accessible from the client anymore.
161161

162-
To test your changes in a browser (``http://localhost:4321/?name=Fabien``), run
162+
To test your changes in a browser (``http://localhost:4321/hello/?name=Fabien``), run
163163
the PHP built-in server:
164164

165165
.. code-block:: bash

create_framework/http-foundation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ the wheel.
299299
I've almost forgot to talk about one added benefit: using the HttpFoundation
300300
component is the start of better interoperability between all frameworks and
301301
applications using it (like `Symfony`_, `Drupal 8`_, `phpBB 4`_, `ezPublish
302-
5`_, `Laravel`_, `Silex`_, and `more`_).
302+
5`_, `Laravel`_, `Silex`_ and `more`_).
303303

304304
.. _`Twig`: http://twig.sensiolabs.org/
305305
.. _`HTTP specification`: http://tools.ietf.org/wg/httpbis/

create_framework/http-kernel-httpkernel-class.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ There should be an easier way, right?
1111

1212
Enter the ``HttpKernel`` class. Instead of solving the same problem over and
1313
over again and instead of reinventing the wheel each time, the ``HttpKernel``
14-
class is a generic, extensible, and flexible implementation of
14+
class is a generic, extensible and flexible implementation of
1515
``HttpKernelInterface``.
1616

1717
This class is very similar to the framework class we have written so far: it

create_framework/routing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ of default values for route attributes (``array('name' => 'World')``).
8282
:doc:`Routing component documentation </components/routing/introduction>` to
8383
learn more about its many features like URL generation, attribute
8484
requirements, HTTP method enforcements, loaders for YAML or XML files,
85-
dumpers to PHP or Apache rewrite rules for enhanced performance, and much
85+
dumpers to PHP or Apache rewrite rules for enhanced performance and much
8686
more.
8787

8888
Based on the information stored in the ``RouteCollection`` instance, a

create_framework/separation-of-concerns.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class. It would bring us better *reusability* and easier testing to name just
88
a few benefits.
99

1010
If you have a closer look at the code, ``front.php`` has one input, the
11-
Request, and one output, the Response. Our framework class will follow this
11+
Request and one output, the Response. Our framework class will follow this
1212
simple principle: the logic is about creating the Response associated with a
1313
Request.
1414

create_framework/templating.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ rendered::
5050

5151
As ``render_template`` is used as an argument to the PHP ``call_user_func()``
5252
function, we can replace it with any valid PHP `callbacks`_. This allows us to
53-
use a function, an anonymous function, or a method of a class as a
53+
use a function, an anonymous function or a method of a class as a
5454
controller... your choice.
5555

5656
As a convention, for each route, the associated controller is configured via
28.3 KB
Loading
29.8 KB
Loading
33 KB
Loading
50.5 KB
Loading
39.2 KB
Loading

0 commit comments

Comments
 (0)