Skip to content

Commit c2b5a6a

Browse files
committed
Merge branch '2.6' into 2.7
2 parents c4a5661 + 644aae8 commit c2b5a6a

File tree

16 files changed

+78
-56
lines changed

16 files changed

+78
-56
lines changed

book/security.rst

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ sections:
2121
#. Fetching the current User object.
2222

2323
These are followed by a number of small (but still captivating) sections,
24-
like :ref:`logging out <book-security-logging-out>` and :ref:`encoding user passwords <security-encoding-password>`.
24+
like :ref:`logging out <book-security-logging-out>` and
25+
:ref:`encoding user passwords <security-encoding-password>`.
2526

2627
.. _book-security-firewalls:
2728

@@ -362,6 +363,11 @@ probably only need one. If you *do* have multiple, you can configure which
362363
*one* provider to use for your firewall under its ``provider`` key (e.g.
363364
``provider: in_memory``).
364365

366+
.. seealso::
367+
368+
See :doc:`/cookbook/security/multiple_user_providers` for
369+
all the details about multiple providers setup.
370+
365371
Try to login using username ``admin`` and password ``kitten``. You should
366372
see an error!
367373

@@ -666,11 +672,11 @@ Add Code to Deny Access
666672

667673
There are **two** ways to deny access to something:
668674

669-
1) :ref:`access_control in security.yml <security-authorization-access-control>`
675+
#. :ref:`access_control in security.yml <security-authorization-access-control>`
670676
allows you to protect URL patterns (e.g. ``/admin/*``). This is easy,
671677
but less flexible;
672678

673-
2) :ref:`in your code via the security.authorization_checker service <book-security-securing-controller>`.
679+
#. :ref:`in your code via the security.authorization_checker service <book-security-securing-controller>`.
674680

675681
.. _security-authorization-access-control:
676682

@@ -838,8 +844,10 @@ In both cases, a special
838844
is thrown, which ultimately triggers a 403 HTTP response inside Symfony.
839845

840846
That's it! If the user isn't logged in yet, they will be asked to login (e.g.
841-
redirected to the login page). If they *are* logged in, they'll be shown
842-
the 403 access denied page (which you can :ref:`customize <cookbook-error-pages-by-status-code>`).
847+
redirected to the login page). If they *are* logged in, but do *not* have the
848+
``ROLE_ADMIN`` role, they'll be shown the 403 access denied page (which you can
849+
:ref:`customize <cookbook-error-pages-by-status-code>`). If they are logged in
850+
and have the correct roles, the code will be executed.
843851

844852
.. _book-security-securing-controller-annotations:
845853

@@ -881,14 +889,13 @@ the built-in helper function:
881889
<a href="...">Delete</a>
882890
<?php endif ?>
883891

884-
If you use this function and are *not* behind a firewall, an exception
885-
will be thrown. Again, it's almost always a good
886-
idea to have a main firewall that covers all URLs (as has been shown
887-
in this chapter).
892+
If you use this function and you are *not* behind a firewall, an exception will
893+
be thrown. Again, it's almost always a good idea to have a main firewall that
894+
covers all URLs (as shown before in this chapter).
888895

889896
.. caution::
890897

891-
Be careful with this in your layout or on your error pages! Because of
898+
Be careful with this in your base layout or on your error pages! Because of
892899
some internal Symfony details, to avoid broken error pages in the ``prod``
893900
environment, wrap calls in these templates with a check for ``app.user``:
894901

@@ -899,10 +906,10 @@ in this chapter).
899906
Securing other Services
900907
.......................
901908

902-
In fact, anything in Symfony can be protected by doing something similar
903-
to this. For example, suppose you have a service (i.e. a PHP class) whose
904-
job is to send emails. You can restrict use of this class - no matter where
905-
it's being used from - to only certain users.
909+
Anything in Symfony can be protected by doing something similar to the code
910+
used to secure a controller. For example, suppose you have a service (i.e. a
911+
PHP class) whose job is to send emails. You can restrict use of this class - no
912+
matter where it's being used from - to only certain users.
906913

907914
For more information see :doc:`/cookbook/security/securing_services`.
908915

@@ -911,7 +918,8 @@ Checking to see if a User is Logged In (IS_AUTHENTICATED_FULLY)
911918

912919
So far, you've checked access based on roles - those strings that start with
913920
``ROLE_`` and are assigned to users. But if you *only* want to check if a
914-
user is logged in (you don't care about roles), then you can see ``IS_AUTHENTICATED_FULLY``::
921+
user is logged in (you don't care about roles), then you can use
922+
``IS_AUTHENTICATED_FULLY``::
915923

916924
// ...
917925

@@ -1026,6 +1034,7 @@ Now you can call whatever methods are on *your* User object. For example,
10261034
if your User object has a ``getFirstName()`` method, you could use that::
10271035

10281036
use Symfony\Component\HttpFoundation\Response;
1037+
// ...
10291038

10301039
public function indexAction()
10311040
{
@@ -1359,7 +1368,7 @@ configuration tree may be useful.
13591368

13601369
Good luck!
13611370

1362-
Learn more from the Cookbook
1371+
Learn More from the Cookbook
13631372
----------------------------
13641373

13651374
* :doc:`Forcing HTTP/HTTPS </cookbook/security/force_https>`

book/templating.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ Throughout this chapter, template examples will be shown in both Twig and PHP.
135135
web designers everywhere.
136136

137137
Twig can also do things that PHP can't, such as whitespace control,
138-
sandboxing, automatic and contextual output escaping, and the inclusion of
139-
custom functions and filters that only affect templates. Twig contains
140-
little features that make writing templates easier and more concise. Take
141-
the following example, which combines a loop with a logical ``if``
138+
sandboxing, automatic HTML escaping, manual contextual output escaping,
139+
and the inclusion of custom functions and filters that only affect templates.
140+
Twig contains little features that make writing templates easier and more concise.
141+
Take the following example, which combines a loop with a logical ``if``
142142
statement:
143143

144144
.. code-block:: html+jinja

components/console/helpers/progressbar.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,4 +330,4 @@ your own::
330330
For the ``filename`` to be part of the progress bar, just add the
331331
``%filename%`` placeholder in your format::
332332

333-
$bar->setFormat(" %message%\n %step%/%max%\n Working on %filename%");
333+
$bar->setFormat(" %message%\n %current%/%max%\n Working on %filename%");

components/console/logger.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ constructor::
9696

9797
// ...
9898
$formatLevelMap = array(
99-
LogLevel::CRITICAL => self::INFO,
100-
LogLevel::DEBUG => self::ERROR,
99+
LogLevel::CRITICAL => ConsoleLogger::INFO,
100+
LogLevel::DEBUG => ConsoleLogger::ERROR,
101101
);
102102
$logger = new ConsoleLogger($output, array(), $formatLevelMap);
103103

components/dependency_injection/factories.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
Using a Factory to Create Services
55
==================================
66

7-
.. versionadded:: 2.6
8-
The new :method:`Symfony\\Component\\DependencyInjection\\Definition::setFactory`
9-
method was introduced in Symfony 2.6. Refer to older versions for the
10-
syntax for factories prior to 2.6.
11-
127
Symfony's Service Container provides a powerful way of controlling the
138
creation of objects, allowing you to specify arguments passed to the constructor
149
as well as calling methods and setting parameters. Sometimes, however, this
@@ -17,6 +12,11 @@ For this situation, you can use a factory to create the object and tell the
1712
service container to call a method on the factory rather than directly instantiating
1813
the class.
1914

15+
.. versionadded:: 2.6
16+
The new :method:`Symfony\\Component\\DependencyInjection\\Definition::setFactory`
17+
method was introduced in Symfony 2.6. Refer to older versions for the
18+
syntax for factories prior to 2.6.
19+
2020
Suppose you have a factory that configures and returns a new ``NewsletterManager``
2121
object::
2222

components/var_dumper/advanced.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ Another option for doing the same could be::
145145
$output = fopen('php://memory', 'r+b');
146146

147147
$dumper->dump($cloner->cloneVar($variable), $output);
148-
rewind($output);
149-
$output = stream_get_contents($output);
148+
$output = stream_get_contents($output, -1, 0);
150149

151150
// $output is now populated with the dump representation of $variable
152151

cookbook/security/entity_provider.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ If a User's ``isActive`` property is set to ``false`` (i.e. ``is_active``
321321
is 0 in the database), the user will still be able to login to the site
322322
normally. This is easily fixable.
323323

324-
To exclude inactive users, change your ``User`` clas to implement
324+
To exclude inactive users, change your ``User`` class to implement
325325
:class:`Symfony\\Component\\Security\\Core\\User\\AdvancedUserInterface`.
326326
This extends :class:`Symfony\\Component\\Security\\Core\\User\\UserInterface`,
327327
so you only need the new interface::

cookbook/templating/render_without_controller.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ a simple template that doesn't need any data passed into it, you can avoid
1010
creating the controller entirely, by using the built-in ``FrameworkBundle:Template:template``
1111
controller.
1212

13-
For example, suppose you want to render a ``AppBundle:Static:privacy.html.twig``
13+
For example, suppose you want to render a ``static/privacy.html.twig``
1414
template, which doesn't require that any variables are passed to it. You
1515
can do this without creating a controller:
1616

@@ -22,7 +22,7 @@ can do this without creating a controller:
2222
path: /privacy
2323
defaults:
2424
_controller: FrameworkBundle:Template:template
25-
template: 'AppBundle:Static:privacy.html.twig'
25+
template: static/privacy.html.twig
2626
2727
.. code-block:: xml
2828
@@ -34,7 +34,7 @@ can do this without creating a controller:
3434
3535
<route id="acme_privacy" path="/privacy">
3636
<default key="_controller">FrameworkBundle:Template:template</default>
37-
<default key="template">AppBundle:Static:privacy.html.twig</default>
37+
<default key="template">static/privacy.html.twig</default>
3838
</route>
3939
</routes>
4040
@@ -46,7 +46,7 @@ can do this without creating a controller:
4646
$collection = new RouteCollection();
4747
$collection->add('acme_privacy', new Route('/privacy', array(
4848
'_controller' => 'FrameworkBundle:Template:template',
49-
'template' => 'AppBundle:Static:privacy.html.twig',
49+
'template' => 'static/privacy.html.twig',
5050
)));
5151
5252
return $collection;
@@ -89,7 +89,7 @@ other variables in your route, you can control exactly how your page is cached:
8989
path: /privacy
9090
defaults:
9191
_controller: FrameworkBundle:Template:template
92-
template: 'AppBundle:Static:privacy.html.twig'
92+
template: 'static/privacy.html.twig'
9393
maxAge: 86400
9494
sharedAge: 86400
9595
@@ -103,7 +103,7 @@ other variables in your route, you can control exactly how your page is cached:
103103
104104
<route id="acme_privacy" path="/privacy">
105105
<default key="_controller">FrameworkBundle:Template:template</default>
106-
<default key="template">AppBundle:Static:privacy.html.twig</default>
106+
<default key="template">static/privacy.html.twig</default>
107107
<default key="maxAge">86400</default>
108108
<default key="sharedAge">86400</default>
109109
</route>
@@ -117,7 +117,7 @@ other variables in your route, you can control exactly how your page is cached:
117117
$collection = new RouteCollection();
118118
$collection->add('acme_privacy', new Route('/privacy', array(
119119
'_controller' => 'FrameworkBundle:Template:template',
120-
'template' => 'AppBundle:Static:privacy.html.twig',
120+
'template' => 'static/privacy.html.twig',
121121
'maxAge' => 86400,
122122
'sharedAge' => 86400,
123123
)));

reference/configuration/twig.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,19 @@ TwigBundle Configuration ("twig")
1010
1111
twig:
1212
exception_controller: twig.controller.exception:showAction
13+
1314
form_themes:
1415
1516
# Default:
1617
- form_div_layout.html.twig
1718
19+
# Bootstrap:
20+
- bootstrap_3_layout.html.twig
21+
- bootstrap_3_horizontal_layout.html.twig
22+
1823
# Example:
1924
- MyBundle::form.html.twig
25+
2026
globals:
2127
2228
# Examples:

reference/forms/types/checkbox.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ Example Usage
3737
.. code-block:: php
3838
3939
$builder->add('public', 'checkbox', array(
40-
'label' => 'Show this entry publicly?',
41-
'required' => false,
40+
'label' => 'Show this entry publicly?',
41+
'required' => false,
4242
));
4343
4444
Field Options

reference/forms/types/choice.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ user sees on the form (e.g. ``Male``).
5151
.. code-block:: php
5252
5353
$builder->add('gender', 'choice', array(
54-
'choices' => array('m' => 'Male', 'f' => 'Female'),
55-
'required' => false,
54+
'choices' => array('m' => 'Male', 'f' => 'Female'),
55+
'required' => false,
5656
));
5757
5858
By setting ``multiple`` to true, you can allow the user to choose multiple
@@ -62,12 +62,12 @@ of checkboxes depending on the ``expanded`` option:
6262
.. code-block:: php
6363
6464
$builder->add('availability', 'choice', array(
65-
'choices' => array(
65+
'choices' => array(
6666
'morning' => 'Morning',
6767
'afternoon' => 'Afternoon',
6868
'evening' => 'Evening',
6969
),
70-
'multiple' => true,
70+
'multiple' => true,
7171
));
7272
7373
You can also use the ``choice_list`` option, which takes an object that can
@@ -90,7 +90,7 @@ by this field. The ``choices`` option is an array, where the array key
9090
is the item value and the array value is the item's label::
9191

9292
$builder->add('gender', 'choice', array(
93-
'choices' => array('m' => 'Male', 'f' => 'Female')
93+
'choices' => array('m' => 'Male', 'f' => 'Female'),
9494
));
9595

9696
.. tip::

reference/forms/types/entity.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ option. The easiest way to use the option is as follows::
7676

7777
$builder->add('users', 'entity', array(
7878
'class' => 'AcmeHelloBundle:User',
79-
'query_builder' => function(EntityRepository $er) {
79+
'query_builder' => function (EntityRepository $er) {
8080
return $er->createQueryBuilder('u')
8181
->orderBy('u.username', 'ASC');
8282
},

reference/forms/types/options/trim.rst.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ trim
44
**type**: ``Boolean`` **default**: ``true``
55

66
If true, the whitespace of the submitted string value will be stripped
7-
via the ``trim()`` function when the data is bound. This guarantees that
7+
via the :phpfunction:`trim` function when the data is bound. This guarantees that
88
if a value is submitted with extra whitespace, it will be removed before
99
the value is merged back onto the underlying object.

reference/forms/types/password.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,12 @@ The default value is ``''`` (the empty string).
7676

7777
.. include:: /reference/forms/types/options/required.rst.inc
7878

79-
.. include:: /reference/forms/types/options/trim.rst.inc
79+
trim
80+
~~~~
81+
82+
**type**: ``Boolean`` **default**: ``false``
83+
84+
If true, the whitespace of the submitted string value will be stripped
85+
via the :phpfunction:`trim` function when the data is bound. This guarantees that
86+
if a value is submitted with extra whitespace, it will be removed before
87+
the value is merged back onto the underlying object.

reference/forms/types/timezone.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ you should just use the ``choice`` type directly.
1818
+-------------+------------------------------------------------------------------------+
1919
| Rendered as | can be various tags (see :ref:`forms-reference-choice-tags`) |
2020
+-------------+------------------------------------------------------------------------+
21-
| Overridden | - `choice_list`_ |
21+
| Overridden | - `choices`_ |
2222
| Options | |
2323
+-------------+------------------------------------------------------------------------+
2424
| Inherited | from the :doc:`choice </reference/forms/types/choice>` type |
@@ -49,12 +49,12 @@ you should just use the ``choice`` type directly.
4949
Overridden Options
5050
------------------
5151

52-
choice_list
53-
~~~~~~~~~~~
52+
choices
53+
~~~~~~~
5454

5555
**default**: :class:`Symfony\\Component\\Form\\Extension\\Core\\ChoiceList\\TimezoneChoiceList`
5656

57-
The Timezone type defaults the choice_list to all timezones returned by
57+
The Timezone type defaults the choices to all timezones returned by
5858
:phpmethod:`DateTimeZone::listIdentifiers`, broken down by continent.
5959

6060
Inherited Options

reference/twig_reference.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ asset
103103
``path``
104104
**type**: ``string``
105105
``packageName``
106-
**type**: ``string``|``null`` **default**: ``null``
106+
**type**: ``string`` | ``null`` **default**: ``null``
107107
``absolute``
108108
**type**: ``boolean`` **default**: ``false``
109109
``version``
@@ -113,12 +113,12 @@ Returns a public path to ``path``, which takes into account the base path set
113113
for the package and the URL path. More information in
114114
:ref:`book-templating-assets`. For asset versioning, see :ref:`ref-framework-assets-version`.
115115

116-
asset_version
117-
~~~~~~~~~~~~~
116+
assets_version
117+
~~~~~~~~~~~~~~
118118

119119
.. code-block:: jinja
120120
121-
{{ asset_version(packageName) }}
121+
{{ assets_version(packageName) }}
122122
123123
``packageName``
124124
**type**: ``string`` | ``null`` **default**: ``null``

0 commit comments

Comments
 (0)