Skip to content

Commit

Permalink
Merge branch '2.4' into 2.5
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
weaverryan committed Jul 11, 2014
2 parents a1435e5 + b6e631e commit 21e1df6
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 52 deletions.
46 changes: 0 additions & 46 deletions book/testing.rst
Expand Up @@ -487,52 +487,6 @@ To get the Profiler for the last request, do the following::
For specific details on using the profiler inside a test, see the
:doc:`/cookbook/testing/profiling` cookbook entry.

To avoid collecting data in each test you can set the ``collect`` parameter
in the configuration:

.. configuration-block::

.. code-block:: yaml
# app/config/config_test.yml
# ...
framework:
profiler:
enabled: true
collect: false
.. code-block:: xml
<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<!-- ... -->
<framework:config>
<framework:profiler enabled="true" collect="false" />
</framework:config>
</container>
.. code-block:: php
// app/config/config.php
// ...
$container->loadFromExtension('framework', array(
'profiler' => array(
'enabled' => true,
'collect' => false,
),
));
In this way only tests that call ``enableProfiler()`` will collect data.

Redirecting
~~~~~~~~~~~

Expand Down
6 changes: 1 addition & 5 deletions components/expression_language/extending.rst
Expand Up @@ -35,11 +35,7 @@ This method has 3 arguments:
$language = new ExpressionLanguage();
$language->register('lowercase', function ($str) {
if (!is_string($str)) {
return $str;
}
return sprintf('strtolower(%s)', $str);
is_string(%1$s) ? strtolower(%1$s) : %1$s;
}, function ($arguments, $str) {
if (!is_string($str)) {
return $str;
Expand Down
5 changes: 4 additions & 1 deletion contributing/code/bc.rst
Expand Up @@ -138,7 +138,7 @@ your overridden method wouldn't match anymore and generate a fatal error.
.. note::

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

In some cases, only specific properties and methods are tagged with the ``@api``
Expand Down Expand Up @@ -307,6 +307,9 @@ Add type hint to an argument Yes Yes
Remove type hint of an argument Yes Yes
Change argument type Yes Yes
Change return type Yes Yes
**Static Methods**
Turn non static into static No No
Turn static into non static No No
================================================== ============== ==============

.. [1] Your code may be broken by changes in the Symfony code. Such changes will
Expand Down
6 changes: 6 additions & 0 deletions cookbook/cache/varnish.rst
Expand Up @@ -38,6 +38,11 @@ application:
set req.http.Surrogate-Capability = "abc=ESI/1.0";
}
.. note::

The ``abc`` part of the header isn't important unless you have multiple "surrogates"
that need to advertise their capabilities. See `Surrogate-Capability Header`_ for details.

Then, optimize Varnish so that it only parses the Response contents when there
is at least one ESI tag by checking the ``Surrogate-Control`` header that
Symfony2 adds automatically:
Expand Down Expand Up @@ -217,3 +222,4 @@ absolute URLs:
.. _`Varnish`: https://www.varnish-cache.org
.. _`Edge Architecture`: http://www.w3.org/TR/edge-arch
.. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html
.. _`Surrogate-Capability Header`: http://www.w3.org/TR/edge-arch
16 changes: 16 additions & 0 deletions cookbook/form/form_customization.rst
Expand Up @@ -298,6 +298,22 @@ When the ``form.age`` widget is rendered, Symfony will use the ``integer_widget`
block from the new template and the ``input`` tag will be wrapped in the
``div`` element specified in the customized block.

Multiple Templates
..................

A form can also be customized by applying several templates. To do this, pass the
name of all the templates as an array using the ``with`` keyword:

.. code-block:: html+jinja

{% form_theme form with ['::common.html.twig', ':Form:fields.html.twig',
'AcmeDemoBundle:Form:fields.html.twig'] %}

{# ... #}

The templates can be located at different bundles and they can even be stored
at the global ``app/Resources/views/`` directory.

Child Forms
...........

Expand Down
49 changes: 49 additions & 0 deletions cookbook/testing/profiling.rst
Expand Up @@ -73,3 +73,52 @@ finish. It's easy to achieve if you embed the token in the error message::

Read the API for built-in :doc:`data collectors </cookbook/profiler/data_collector>`
to learn more about their interfaces.

Speeding up Tests by not Collecting Profiler Data
-------------------------------------------------

To avoid collecting data in each test you can set the ``collect`` parameter
to false:

.. configuration-block::

.. code-block:: yaml
# app/config/config_test.yml
# ...
framework:
profiler:
enabled: true
collect: false
.. code-block:: xml
<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<!-- ... -->
<framework:config>
<framework:profiler enabled="true" collect="false" />
</framework:config>
</container>
.. code-block:: php
// app/config/config.php
// ...
$container->loadFromExtension('framework', array(
'profiler' => array(
'enabled' => true,
'collect' => false,
),
));
In this way only tests that call ``$client->enableProfiler()`` will collect data.

0 comments on commit 21e1df6

Please sign in to comment.