8000 Merge branch '2.4' into 2.5 · symfony/symfony-docs@21e1df6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 21e1df6

Browse files
committed
Merge branch '2.4' into 2.5
* 2.4: document the mysterious abc part of the header Removed return statement Fix function example in expression language component Fixed a minor grammar mistake [Console] Fix Console component getHelperSet()->get() to getHelper() plug rules for static methods Move the section about collect: false to the cookbook entry Fixed a minor error Removed the old syntax and left just the "with" keyword syntax Fixed minor formatting issue Minor formatting improvement Added a note about customizing a form with more than one template
2 parents a1435e5 + b6e631e commit 21e1df6

File tree

6 files changed

+76
-52
lines changed

6 files changed

+76
-52
lines changed

book/testing.rst

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -487,52 +487,6 @@ To get the Profiler for the last request, do the following::
487487
For specific details on using the profiler inside a test, see the
488488
:doc:`/cookbook/testing/profiling` cookbook entry.
489489

490-
To avoid collecting data in each test you can set the ``collect`` parameter
491-
in the configuration:
492-
493-
.. configuration-block::
494-
495-
.. code-block:: yaml
496-
497-
# app/config/config_test.yml
498-
499-
# ...
500-
framework:
501-
profiler:
502-
enabled: true
503-
collect: false
504-
505-
.. code-block:: xml
506-
507-
<!-- app/config/config.xml -->
508-
<?xml version="1.0" encoding="UTF-8" ?>
509-
<container xmlns="http://symfony.com/schema/dic/services"
510-
xmlns:framework="http://symfony.com/schema/dic/symfony"
511-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
512-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
513-
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
514-
515-
<!-- ... -->
516-
517-
<framework:config>
518-
<framework:profiler enabled="true" collect="false" />
519-
</framework:config>
520-
</container>
521-
522-
.. code-block:: php
523-
524-
// app/config/config.php
525-
526-
// ...
527-
$container->loadFromExtension('framework', array(
528-
'profiler' => array(
529-
'enabled' => true,
530-
'collect' => false,
531-
),
532-
));
533-
534-
In this way only tests that call ``enableProfiler()`` will collect data.
535-
536490
Redirecting
537491
~~~~~~~~~~~
538492

components/expression_language/extending.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ This method has 3 arguments:
3535
3636
$language = new ExpressionLanguage();
3737
$language->register('lowercase', function ($str) {
38-
if (!is_string($str)) {
39-
return $str;
40-
}
41-
42-
return sprintf('strtolower(%s)', $str);
38+
is_string(%1$s) ? strtolower(%1$s) : %1$s;
4339
}, function ($arguments, $str) {
4440
if (!is_string($str)) {
4541
return $str;

contributing/code/bc.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ your overridden method wouldn't match anymore and generate a fatal error.
138138
.. note::
139139

140140
As with interfaces, we limit ourselves to changes that can be upgraded
141-
easily. We will document the precise ugprade instructions in the UPGRADE
141+
easily. We will document the precise upgrade instructions in the UPGRADE
142142
file in Symfony's root directory.
143143

144144
In some cases, only specific properties and methods are tagged with the ``@api``
@@ -307,6 +307,9 @@ Add type hint to an argument Yes Yes
307307
Remove type hint of an argument Yes Yes
308308
Change argument type Yes Yes
309309
Change return type Yes Yes
310+
**Static Methods**
311+
Turn non static into static No No
312+
Turn static into non static No No
310313
================================================== ============== ==============
311314

312315
.. [1] Your code may be broken by changes in the Symfony code. Such changes will

cookbook/cache/varnish.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ application:
3838
set req.http.Surrogate-Capability = "abc=ESI/1.0";
3939
}
4040
41+
.. note::
42+
43+
The ``abc`` part of the header isn't important unless you have multiple "surrogates"
44+
that need to advertise their capabilities. See `Surrogate-Capability Header`_ for details.
45+
4146
Then, optimize Varnish so that it only parses the Response contents when there
4247
is at least one ESI tag by checking the ``Surrogate-Control`` header that
4348
Symfony2 adds automatically:
@@ -217,3 +222,4 @@ absolute URLs:
217222
.. _`Varnish`: https://www.varnish-cache.org
218223
.. _`Edge Architecture`: http://www.w3.org/TR/edge-arch
219224
.. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html
225+
.. _`Surrogate-Capability Header`: http://www.w3.org/TR/edge-arch

cookbook/form/form_customization.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,22 @@ When the ``form.age`` widget is rendered, Symfony will use the ``integer_widget`
298298
block from the new template and the ``input`` tag will be wrapped in the
299299
``div`` element specified in the customized block.
300300

301+
Multiple Templates
302+
..................
303+
304+
A form can also be customized by applying several templates. To do this, pass the
305+
name of all the templates as an array using the ``with`` keyword:
306+
307+
.. code-block:: html+jinja
308+
309+
{% form_theme form with ['::common.html.twig', ':Form:fields.html.twig',
310+
'AcmeDemoBundle:Form:fields.html.twig'] %}
311+
312+
{# ... #}
313+
314+
The templates can be located at different bundles and they can even be stored
315+
at the global ``app/Resources/views/`` directory.
316+
301317
Child Forms
302318
...........
303319

cookbook/testing/profiling.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,52 @@ finish. It's easy to achieve if you embed the token in the error message::
7373

7474
Read the API for built-in :doc:`data collectors </cookbook/profiler/data_collector>`
7575
to learn more about their interfaces.
76+
77+
Speeding up Tests by not Collecting Profiler Data
78+
-------------------------------------------------
79+
80+
To avoid collecting data in each test you can set the ``collect`` parameter
81+
to false:
82+
83+
.. configuration-block::
84+
85+
.. code-block:: yaml
86+
87+
# app/config/config_test.yml
88+
89+
# ...
90+
framework:
91+
profiler:
92+
enabled: true
93+
collect: false
94+
95+
.. code-block:: xml
96+
97+
<!-- app/config/config.xml -->
98+
<?xml version="1.0" encoding="UTF-8" ?>
99+
<container xmlns="http://symfony.com/schema/dic/services"
100+
xmlns:framework="http://symfony.com/schema/dic/symfony"
101+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
102+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
103+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
104+
105+
<!-- ... -->
106+
107+
<framework:config>
108+
<framework:profiler enabled="true" collect="false" />
109+
</framework:config>
110+
</container>
111+
112+
.. code-block:: php
113+
114+
// app/config/config.php
115+
116+
// ...
117+
$container->loadFromExtension('framework', array(
118+
'profiler' => array(
119+
'enabled' => true,
120+
'collect' => false,
121+
),
122+
));
123+
124+
In this way only tests that call ``$client->enableProfiler()`` will collect data.

0 commit comments

Comments
 (0)
0