Skip to content

Commit f31a965

Browse files
committed
Merge branch '2.8' into 3.0
2 parents 14d2afb + f792232 commit f31a965

File tree

15 files changed

+122
-45
lines changed

15 files changed

+122
-45
lines changed

book/forms.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,7 @@ The CSRF token can be customized on a form-by-form basis. For example::
18101810
'csrf_protection' => true,
18111811
'csrf_field_name' => '_token',
18121812
// a unique key to help generate the secret token
1813-
'intention' => 'task_item',
1813+
'csrf_token_id' => 'task_item',
18141814
));
18151815
}
18161816

@@ -1826,8 +1826,12 @@ section.
18261826

18271827
.. note::
18281828

1829-
The ``intention`` option is optional but greatly enhances the security of
1830-
the generated token by making it different for each form.
1829+
The ``csrf_token_id`` option is optional but greatly enhances the security
1830+
of the generated token by making it different for each form.
1831+
1832+
.. versionadded:: 2.4
1833+
The ``csrf_token_id`` option was introduced in Symfony 2.4. Prior, you
1834+
had to use the ``intention`` option.
18311835

18321836
.. caution::
18331837

components/dependency_injection/advanced.rst

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,79 @@ You can change the inner service name if you want to:
219219
->setPublic(false)
220220
->setDecoratedService('foo', 'bar.wooz');
221221
222+
.. versionadded:: 2.8
223+
The ability to define the decoration priority was introduced in Symfony 2.8.
224+
Prior to Symfony 2.8, the priority depends on the order in
225+
which definitions are found.
226+
227+
If you want to apply more than one decorator to a service, you can control their
228+
order by configuring the priority of decoration, this can be any integer number
229+
(decorators with higher priorities will be applied first).
230+
231+
.. configuration-block::
232+
233+
.. code-block:: yaml
234+
235+
foo:
236+
class: Foo
237+
238+
bar:
239+
class: Bar
240+
public: false
241+
decorates: foo
242+
decoration_priority: 5
243+
arguments: ['@bar.inner']
244+
245+
baz:
246+
class: Baz
247+
public: false
248+
decorates: foo
249+
decoration_priority: 1
250+
arguments: ['@baz.inner']
251+
252+
.. code-block:: xml
253+
254+
<?xml version="1.0" encoding="UTF-8" ?>
255+
256+
<container xmlns="http://symfony.com/schema/dic/services"
257+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
258+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
259+
260+
<services>
261+
<service id="foo" class="Foo" />
262+
263+
<service id="bar" class="Bar" decorates="foo" decoration-priority="5" public="false">
264+
<argument type="service" id="bar.inner" />
265+
</service>
266+
267+
<service id="baz" class="Baz" decorates="foo" decoration-priority="1" public="false">
268+
<argument type="service" id="baz.inner" />
269+
</service>
270+
</services>
271+
</container>
272+
273+
.. code-block:: php
274+
275+
use Symfony\Component\DependencyInjection\Reference;
276+
277+
$container->register('foo', 'Foo')
278+
279+
$container->register('bar', 'Bar')
280+
->addArgument(new Reference('bar.inner'))
281+
->setPublic(false)
282+
->setDecoratedService('foo', null, 5);
283+
284+
$container->register('baz', 'Baz')
285+
->addArgument(new Reference('baz.inner'))
286+
->setPublic(false)
287+
->setDecoratedService('foo', null, 1);
288+
289+
The generated code will be the following:
290+
291+
.. code-block:: php
292+
293+
$this->services['foo'] = new Baz(new Bar(new Foo())));
294+
222295
Deprecating Services
223296
--------------------
224297

components/expression_language/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Expression Language
2-
===================
1+
ExpressionLanguage
2+
==================
33

44
.. toctree::
55
:maxdepth: 2

components/form/introduction.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ builder:
452452

453453
.. code-block:: php-standalone
454454
455+
use Symfony\Component\Form\Extension\Core\Type\FormType;
455456
use Symfony\Component\Form\Extension\Core\Type\TextType;
456457
use Symfony\Component\Form\Extension\Core\Type\DateType;
457458
@@ -461,7 +462,7 @@ builder:
461462
'dueDate' => new \DateTime('tomorrow'),
462463
);
463464
464-
$form = $formFactory->createBuilder('form', $defaults)
465+
$form = $formFactory->createBuilder(FormType::class, $defaults)
465466
->add('task', TextType::class)
466467
->add('dueDate', DateType::class)
467468
->getForm();

components/http_foundation/introduction.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,22 +151,15 @@ exist::
151151

152152
When PHP imports the request query, it handles request parameters like
153153
``foo[bar]=bar`` in a special way as it creates an array. So you can get the
154-
``foo`` parameter and you will get back an array with a ``bar`` element. But
155-
sometimes, you might want to get the value for the "original" parameter name:
156-
``foo[bar]``. This is possible with all the ``ParameterBag`` getters like
157-
:method:`Symfony\\Component\\HttpFoundation\\Request::get` via the third
158-
argument::
154+
``foo`` parameter and you will get back an array with a ``bar`` element::
159155

160156
// the query string is '?foo[bar]=bar'
161157

162158
$request->query->get('foo');
163159
// returns array('bar' => 'bar')
164160

165161
$request->query->get('foo[bar]');
166-
// returns null
167-
168-
$request->query->get('foo[bar]', null, true);
169-
// returns 'bar'
162+
// returns null
170163

171164
.. _component-foundation-attributes:
172165

cookbook/configuration/override_dir_structure.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Override the ``cache`` Directory
3636
--------------------------------
3737

3838
You can change the default cache directory by overriding the ``getCacheDir`` method
39-
in the ``AppKernel`` class of you application::
39+
in the ``AppKernel`` class of your application::
4040

4141
// app/AppKernel.php
4242

cookbook/controller/upload_file.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@ Then, add a new ``brochure`` field to the form that manages the ``Product`` enti
7676
'data_class' => 'AppBundle\Entity\Product',
7777
));
7878
}
79-
80-
public function getName()
81-
{
82-
return 'product';
83-
}
8479
}
8580

8681
Now, update the template that renders the form to display the new ``brochure``

cookbook/form/create_form_type_extension.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ by your extension.
7373
.. tip::
7474

7575
The value you return in the ``getExtendedType`` method corresponds
76-
to the value returned by the ``getName`` method in the form type class
77-
you wish to extend.
76+
to the fully qualified class name of the form type class you wish to
77+
extend.
7878

7979
In addition to the ``getExtendedType`` function, you will probably want
8080
to override one of the following methods:

cookbook/form/dynamic_form_modification.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ a bare form class looks like::
5757
'data_class' => 'AppBundle\Entity\Product'
5858
));
5959
}
60-
61-
public function getName()
62-
{
63-
return 'product';
64-
}
6560
}
6661

6762
.. note::

cookbook/form/form_customization.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,8 @@ will be able to change the widget for each task as follows:
774774

775775
{% block _tasks_entry_widget %}
776776
<tr>
777-
<td>{{ form_widget(task.task) }}</td>
778-
<td>{{ form_widget(task.dueDate) }}</td>
777+
<td>{{ form_widget(form.task) }}</td>
778+
<td>{{ form_widget(form.dueDate) }}</td>
779779
</tr>
780780
{% endblock %}
781781

0 commit comments

Comments
 (0)