Skip to content

Commit

Permalink
Merge branch '3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Aug 11, 2016
2 parents 42d7888 + 79bd63c commit da458d5
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 48 deletions.
3 changes: 2 additions & 1 deletion components/cache/cache_pools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ application as if they were Symfony Cache adapters::
use Doctrine\Common\Cache\SQLite3Cache;
use Symfony\Component\Cache\Adapter\DoctrineAdapter;

$doctrineCache = new SQLite3Cache(__DIR__.'/cache/data.sqlite');
$sqliteDatabase = new \SQLite3(__DIR__.'/cache/data.sqlite');
$doctrineCache = new SQLite3Cache($sqliteDatabase, 'tableName');
$symfonyCache = new DoctrineAdapter($doctrineCache);

This adapter also defines two optional arguments called ``namespace`` (default:
Expand Down
44 changes: 15 additions & 29 deletions components/form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ CSRF Protection

Protection against CSRF attacks is built into the Form component, but you need
to explicitly enable it or replace it with a custom solution. If you want to
use the built-in support, require the Security CSRF component by executing
``composer require symfony/security-csrf``.
use the built-in support, first install the Security CSRF component:

.. code-block:: bash
$ composer require symfony/security-csrf
The following snippet adds CSRF protection to the form factory::

Expand Down Expand Up @@ -157,18 +160,12 @@ to easily render your form as HTML form fields (complete with field values,
errors, and labels). If you use `Twig`_ as your template engine, the Form
component offers a rich integration.

To use the integration, you'll need the ``TwigBridge``, which provides integration
between Twig and several Symfony components. If you're using Composer, you
could install the latest 3.x version by adding the following ``require``
line to your ``composer.json`` file:
To use the integration, you'll need the twig bridge, which provides integration
between Twig and several Symfony components:

.. code-block:: json
.. code-block:: bash
{
"require": {
"symfony/twig-bridge": "~3.0"
}
}
$ composer require symfony/twig-bridge
The TwigBridge integration provides you with several :doc:`Twig Functions </reference/forms/twig_reference>`
that help you render the HTML widget, label and error for each field
Expand Down Expand Up @@ -242,17 +239,11 @@ via your own Twig extension.

To use the built-in integration, be sure that your project has Symfony's
Translation and :doc:`Config </components/config>` components
installed. If you're using Composer, you could get the latest 3.x version
of each of these by adding the following to your ``composer.json`` file:
installed:

.. code-block:: json
.. code-block:: bash
{
"require": {
"symfony/translation": "~3.0",
"symfony/config": "~3.0"
}
}
$ composer require symfony/translation symfony/config
Next, add the :class:`Symfony\\Bridge\\Twig\\Extension\\TranslationExtension`
to your ``Twig_Environment`` instance::
Expand Down Expand Up @@ -293,16 +284,11 @@ no problem! Simply take the submitted/bound data of your form (which is an
array or object) and pass it through your own validation system.

To use the integration with Symfony's Validator component, first make sure
it's installed in your application. If you're using Composer and want to
install the latest 3.x version, add this to your ``composer.json``:
it's installed in your application:

.. code-block:: json
.. code-block:: bash
{
"require": {
"symfony/validator": "~3.0"
}
}
$ composer require symfony/validator
If you're not familiar with Symfony's Validator component, read more about
it: :doc:`/validation`. The Form component comes with a
Expand Down
1 change: 0 additions & 1 deletion controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ abstraction around the HTTP response - the text-based message filled with
headers and content that's sent back to the client::

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;

// create a simple Response with a 200 status code (the default)
$response = new Response('Hello '.$name, Response::HTTP_OK);
Expand Down
2 changes: 1 addition & 1 deletion controller/argument_value_resolver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ When all those requirements are met and ``true`` is returned, the
``supports()``.

That's it! Now all you have to do is add the configuration for the service
container. This can be done by tagging the service with ``controller.argument_resolver``
container. This can be done by tagging the service with ``controller.argument_value_resolver``
and adding a priority.

.. configuration-block::
Expand Down
2 changes: 1 addition & 1 deletion http_cache/varnish.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ header:
.. code-block:: varnish4
sub vcl_recv {
remove req.http.Forwarded;
unset req.http.Forwarded;
}
If you do not have access to your Varnish configuration, you can instead
Expand Down
2 changes: 1 addition & 1 deletion logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -327,5 +327,5 @@ Learn more

.. _Monolog: https://github.com/Seldaek/monolog
.. _LoggerInterface: https://github.com/php-fig/log/blob/master/Psr/Log/LoggerInterface.php
.. _`logrotate`: https://fedorahosted.org/logrotate/
.. _`logrotate`: https://github.com/logrotate/logrotate
.. _`Monolog Configuration`: https://github.com/symfony/monolog-bundle/blob/master/DependencyInjection/Configuration.php#L25
7 changes: 3 additions & 4 deletions reference/configuration/twig.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ TwigBundle Configuration ("twig")
<twig:config
auto-reload="%kernel.debug%"
autoescape="true"
autoescape="filename"
base-template-class="Twig_Template"
cache="%kernel.cache_dir%/twig"
charset="%kernel.charset%"
Expand Down Expand Up @@ -95,7 +95,7 @@ TwigBundle Configuration ("twig")
'pi' => 3.14,
),
'auto_reload' => '%kernel.debug%',
'autoescape' => true,
'autoescape' => 'filename',
'base_template_class' => 'Twig_Template',
'cache' => '%kernel.cache_dir%/twig',
'charset' => '%kernel.charset%',
Expand Down Expand Up @@ -131,8 +131,7 @@ autoescape

**type**: ``boolean`` or ``string`` **default**: ``'filename'``

If set to ``true``, all template contents are escaped for HTML. If set to
``false``, automatic escaping is disabled (you can still escape each content
If set to ``false``, automatic escaping is disabled (you can still escape each content
individually in the templates).

.. caution::
Expand Down
2 changes: 1 addition & 1 deletion service_container/lazy_services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ You can mark the service as ``lazy`` by manipulating its definition:
Once you inject the service into another service, a virtual `proxy`_ with the
same signature of the class representing the service should be injected. The
same happends when calling ``Container::get()`` directly.
same happens when calling ``Container::get()`` directly.

The actual class will be instantiated as soon as you try to interact with the
service (e.g. call one of its methods).
Expand Down
10 changes: 1 addition & 9 deletions templating/global_variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,4 @@ This should feel familiar, as it's the same syntax you use in service configurat
'globals' => array(
'user_management' => '@app.user_management',
),
));
Using a Twig Extension
----------------------

If the global variable you want to set is more complicated - say an object -
then you won't be able to use the above method. Instead, you'll need to create
a :ref:`Twig Extension <reference-dic-tags-twig-extension>` and return the
global variable as one of the entries in the ``getGlobals`` method.
));

0 comments on commit da458d5

Please sign in to comment.