Skip to content

Commit c33b371

Browse files
committed
Merge branch '2.7'
* 2.7: [#4805] Adding versionadded added documentation for the new absolute_url() and relative_path() Twig functions Remove 'acme' Update routing.rst [#4786] Adding a few versionadded's for the changed method name Replaced setDefaultOptions by the new configureOptions method Typo Update introduction.rst [Book][Translation] Added tip for routing params [varnish] be more precise about version differences Remove trailing whitespace [BestPractices] fix minor typo Remove horizontal scrollbar [Components][Debug] fix DebugClassLoader namespace Update override.rst Update override.rst [Book][Security] add back old anchors [Cookbook][Security] Hint about createToken can return null Add version added note for the debug:event-dispatcher command Conflicts: reference/twig_reference.rst
2 parents 6c498d4 + 61ea87b commit c33b371

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+200
-147
lines changed

best_practices/forms.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ form in its own PHP class::
2121

2222
use Symfony\Component\Form\AbstractType;
2323
use Symfony\Component\Form\FormBuilderInterface;
24-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
24+
use Symfony\Component\OptionsResolver\OptionsResolver;
2525

2626
class PostType extends AbstractType
2727
{
@@ -36,7 +36,7 @@ form in its own PHP class::
3636
;
3737
}
3838

39-
public function setDefaultOptions(OptionsResolverInterface $resolver)
39+
public function configureOptions(OptionsResolver $resolver)
4040
{
4141
$resolver->setDefaults(array(
4242
'data_class' => 'AppBundle\Entity\Post'

best_practices/security.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ Security Voters
245245

246246
If your security logic is complex and can't be centralized into a method
247247
like ``isAuthor()``, you should leverage custom voters. These are an order
248-
of magnitude easier than :doc:`ACL's </cookbook/security/acl>` and will give
248+
of magnitude easier than :doc:`ACLs </cookbook/security/acl>` and will give
249249
you the flexibility you need in almost all cases.
250250

251251
First, create a voter class. The following example shows a voter that implements

book/forms.rst

+21-17
Original file line numberDiff line numberDiff line change
@@ -470,13 +470,17 @@ you'll need to specify which validation group(s) your form should use::
470470
'validation_groups' => array('registration'),
471471
))->add(...);
472472

473+
.. versionadded:: 2.7
474+
The ``configureOptions()`` method was introduced in Symfony 2.7. Previously,
475+
the method was called ``setDefaultOptions()``.
476+
473477
If you're creating :ref:`form classes <book-form-creating-form-classes>` (a
474-
good practice), then you'll need to add the following to the ``setDefaultOptions()``
478+
good practice), then you'll need to add the following to the ``configureOptions()``
475479
method::
476480

477-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
481+
use Symfony\Component\OptionsResolver\OptionsResolver;
478482

479-
public function setDefaultOptions(OptionsResolverInterface $resolver)
483+
public function configureOptions(OptionsResolver $resolver)
480484
{
481485
$resolver->setDefaults(array(
482486
'validation_groups' => array('registration'),
@@ -498,9 +502,9 @@ Disabling Validation
498502
Sometimes it is useful to suppress the validation of a form altogether. For
499503
these cases you can set the ``validation_groups`` option to ``false``::
500504

501-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
505+
use Symfony\Component\OptionsResolver\OptionsResolver;
502506

503-
public function setDefaultOptions(OptionsResolverInterface $resolver)
507+
public function configureOptions(OptionsResolver $resolver)
504508
{
505509
$resolver->setDefaults(array(
506510
'validation_groups' => false,
@@ -524,10 +528,10 @@ If you need some advanced logic to determine the validation groups (e.g.
524528
based on submitted data), you can set the ``validation_groups`` option
525529
to an array callback::
526530

527-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
531+
use Symfony\Component\OptionsResolver\OptionsResolver;
528532

529533
// ...
530-
public function setDefaultOptions(OptionsResolverInterface $resolver)
534+
public function configureOptions(OptionsResolver $resolver)
531535
{
532536
$resolver->setDefaults(array(
533537
'validation_groups' => array(
@@ -544,10 +548,10 @@ You can also define whole logic inline by using a ``Closure``::
544548

545549
use Acme\AcmeBundle\Entity\Client;
546550
use Symfony\Component\Form\FormInterface;
547-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
551+
use Symfony\Component\OptionsResolver\OptionsResolver;
548552

549553
// ...
550-
public function setDefaultOptions(OptionsResolverInterface $resolver)
554+
public function configureOptions(OptionsResolver $resolver)
551555
{
552556
$resolver->setDefaults(array(
553557
'validation_groups' => function(FormInterface $form) {
@@ -567,10 +571,10 @@ of the entity as well you have to adjust the option as follows::
567571

568572
use Acme\AcmeBundle\Entity\Client;
569573
use Symfony\Component\Form\FormInterface;
570-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
574+
use Symfony\Component\OptionsResolver\OptionsResolver;
571575

572576
// ...
573-
public function setDefaultOptions(OptionsResolverInterface $resolver)
577+
public function configureOptions(OptionsResolver $resolver)
574578
{
575579
$resolver->setDefaults(array(
576580
'validation_groups' => function(FormInterface $form) {
@@ -1090,9 +1094,9 @@ the choice is ultimately up to you.
10901094
good idea to explicitly specify the ``data_class`` option by adding the
10911095
following to your form type class::
10921096

1093-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
1097+
use Symfony\Component\OptionsResolver\OptionsResolver;
10941098

1095-
public function setDefaultOptions(OptionsResolverInterface $resolver)
1099+
public function configureOptions(OptionsResolver $resolver)
10961100
{
10971101
$resolver->setDefaults(array(
10981102
'data_class' => 'AppBundle\Entity\Task',
@@ -1321,7 +1325,7 @@ create a form class so that a ``Category`` object can be modified by the user::
13211325

13221326
use Symfony\Component\Form\AbstractType;
13231327
use Symfony\Component\Form\FormBuilderInterface;
1324-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
1328+
use Symfony\Component\OptionsResolver\OptionsResolver;
13251329

13261330
class CategoryType extends AbstractType
13271331
{
@@ -1330,7 +1334,7 @@ create a form class so that a ``Category`` object can be modified by the user::
13301334
$builder->add('name');
13311335
}
13321336

1333-
public function setDefaultOptions(OptionsResolverInterface $resolver)
1337+
public function configureOptions(OptionsResolver $resolver)
13341338
{
13351339
$resolver->setDefaults(array(
13361340
'data_class' => 'AppBundle\Entity\Category',
@@ -1756,13 +1760,13 @@ that all un-rendered fields are output.
17561760

17571761
The CSRF token can be customized on a form-by-form basis. For example::
17581762

1759-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
1763+
use Symfony\Component\OptionsResolver\OptionsResolver;
17601764

17611765
class TaskType extends AbstractType
17621766
{
17631767
// ...
17641768

1765-
public function setDefaultOptions(OptionsResolverInterface $resolver)
1769+
public function configureOptions(OptionsResolver $resolver)
17661770
{
17671771
$resolver->setDefaults(array(
17681772
'data_class' => 'AppBundle\Entity\Task',

book/from_flat_php_to_symfony2.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ the layout:
244244

245245
<?php include 'layout.php' ?>
246246

247-
You now have a setup that will allow you to reuse the layout.
247+
You now have a setup that will allow you to reuse the layout.
248248
Unfortunately, to accomplish this, you're forced to use a few ugly
249249
PHP functions (``ob_start()``, ``ob_get_clean()``) in the template. Symfony
250250
uses a Templating component that allows this to be accomplished cleanly

book/http_cache.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@ won't be asked to return the updated response until the cache finally becomes
538538
stale.
539539

540540
The validation model addresses this issue. Under this model, the cache continues
541-
to store responses. The difference is that, for each request, the cache asks the
542-
application if the cached response is still valid or if it needs to be regenerated.
541+
to store responses. The difference is that, for each request, the cache asks the
542+
application if the cached response is still valid or if it needs to be regenerated.
543543
If the cache *is* still valid, your application should return a 304 status code
544544
and no content. This tells the cache that it's ok to return the cached response.
545545

book/routing.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1021,8 +1021,8 @@ routing system can be:
10211021
/**
10221022
* @Route(
10231023
* "/articles/{_locale}/{year}/{title}.{_format}",
1024-
* defaults: {"_format": "html"},
1025-
* requirements: {
1024+
* defaults={"_format": "html"},
1025+
* requirements={
10261026
* "_locale": "en|fr",
10271027
* "_format": "html|rss",
10281028
* "year": "\d+"

book/security.rst

+2
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ But who can you login as? Where do users come from?
275275
or :doc:`build your own </cookbook/security/custom_authentication_provider>`.
276276

277277
.. _security-user-providers:
278+
.. _where-do-users-come-from-user-providers:
278279

279280
B) Configuring how Users are Loaded
280281
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -433,6 +434,7 @@ If you'd like to load your users via the Doctrine ORM, that's easy! See
433434

434435
.. _book-security-encoding-user-password:
435436
.. _c-encoding-the-users-password:
437+
.. _encoding-the-user-s-password:
436438

437439
C) Encoding the User's Password
438440
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

book/service_container.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ the service container gives you a much more appealing option:
569569
services:
570570
my_mailer:
571571
# ...
572-
572+
573573
newsletter_manager:
574574
class: Acme\HelloBundle\Newsletter\NewsletterManager
575575
arguments: ["@my_mailer"]
@@ -762,7 +762,7 @@ Injecting the dependency by the setter method just needs a change of syntax:
762762
services:
763763
my_mailer:
764764
# ...
765-
765+
766766
newsletter_manager:
767767
class: Acme\HelloBundle\Newsletter\NewsletterManager
768768
calls:
@@ -797,7 +797,7 @@ Injecting the dependency by the setter method just needs a change of syntax:
797797
use Symfony\Component\DependencyInjection\Reference;
798798
799799
$container->setDefinition('my_mailer', ...);
800-
800+
801801
$container->setDefinition('newsletter_manager', new Definition(
802802
'Acme\HelloBundle\Newsletter\NewsletterManager'
803803
))->addMethodCall('setMailer', array(
@@ -938,7 +938,7 @@ it exists and do nothing if it doesn't:
938938
<service id="my_mailer">
939939
<!-- ... -->
940940
</service>
941-
941+
942942
<service id="newsletter_manager" class="Acme\HelloBundle\Newsletter\NewsletterManager">
943943
<argument type="service" id="my_mailer" on-invalid="ignore" />
944944
</service>
@@ -953,7 +953,7 @@ it exists and do nothing if it doesn't:
953953
use Symfony\Component\DependencyInjection\ContainerInterface;
954954
955955
$container->setDefinition('my_mailer', ...);
956-
956+
957957
$container->setDefinition('newsletter_manager', new Definition(
958958
'Acme\HelloBundle\Newsletter\NewsletterManager',
959959
array(

book/translation.rst

+6-1
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ via the ``request`` object::
428428

429429
.. tip::
430430

431-
Read :doc:`/cookbook/session/locale_sticky_session` to learn, how to store
431+
Read :doc:`/cookbook/session/locale_sticky_session` to learn how to store
432432
the user's locale in the session.
433433

434434
.. index::
@@ -508,6 +508,11 @@ as the locale for the current request.
508508
You can now use the locale to create routes to other translated pages
509509
in your application.
510510

511+
.. tip::
512+
513+
Read :doc:`/cookbook/routing/service_container_parameters` to learn how to
514+
avoid hardcoding the ``_locale`` requirement in all your routes.
515+
511516
Setting a default Locale
512517
~~~~~~~~~~~~~~~~~~~~~~~~
513518

components/class_loader/cache_class_loader.rst

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
single: ClassLoader; Cache
55
single: ClassLoader; XcacheClassLoader
66
single: XCache; XcacheClassLoader
7-
7+
88
Cache a Class Loader
99
====================
1010

@@ -30,16 +30,16 @@ ApcClassLoader
3030
``findFile()`` method using `APC`_::
3131

3232
require_once '/path/to/src/Symfony/Component/ClassLoader/ApcClassLoader.php';
33-
33+
3434
// instance of a class that implements a findFile() method, like the ClassLoader
3535
$loader = ...;
36-
36+
3737
// sha1(__FILE__) generates an APC namespace prefix
3838
$cachedLoader = new ApcClassLoader(sha1(__FILE__), $loader);
39-
39+
4040
// register the cached class loader
4141
$cachedLoader->register();
42-
42+
4343
// deactivate the original, non-cached loader if it was registered previously
4444
$loader->unregister();
4545

@@ -50,16 +50,16 @@ XcacheClassLoader
5050
it is straightforward::
5151

5252
require_once '/path/to/src/Symfony/Component/ClassLoader/XcacheClassLoader.php';
53-
53+
5454
// instance of a class that implements a findFile() method, like the ClassLoader
5555
$loader = ...;
56-
56+
5757
// sha1(__FILE__) generates an XCache namespace prefix
5858
$cachedLoader = new XcacheClassLoader(sha1(__FILE__), $loader);
59-
59+
6060
// register the cached class loader
6161
$cachedLoader->register();
62-
62+
6363
// deactivate the original, non-cached loader if it was registered previously
6464
$loader->unregister();
6565

components/class_loader/map_class_loader.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.. index::
22
single: ClassLoader; MapClassLoader
3-
3+
44
MapClassLoader
55
==============
66

@@ -26,14 +26,14 @@ Using it is as easy as passing your mapping to its constructor when creating
2626
an instance of the ``MapClassLoader`` class::
2727

2828
require_once '/path/to/src/Symfony/Component/ClassLoader/MapClassLoader';
29-
29+
3030
$mapping = array(
3131
'Foo' => '/path/to/Foo',
3232
'Bar' => '/path/to/Bar',
3333
);
34-
34+
3535
$loader = new MapClassLoader($mapping);
36-
36+
3737
$loader->register();
3838

3939
.. _PSR-0: http://www.php-fig.org/psr/psr-0/

components/console/introduction.rst

-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ tools capable of helping you with different tasks:
404404
* :doc:`/components/console/helpers/formatterhelper`: customize the output colorization
405405
* :doc:`/components/console/helpers/progressbar`: shows a progress bar
406406
* :doc:`/components/console/helpers/table`: displays tabular data as a table
407-
* :doc:`/components/console/helpers/questionhelper`: interactively ask the user for information
408407

409408
.. _component-console-testing-commands:
410409

components/css_selector.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ web-browser.
7676

7777
* link-state selectors: ``:link``, ``:visited``, ``:target``
7878
* selectors based on user action: ``:hover``, ``:focus``, ``:active``
79-
* UI-state selectors: ``:invalid``, ``:indeterminate`` (however, ``:enabled``,
79+
* UI-state selectors: ``:invalid``, ``:indeterminate`` (however, ``:enabled``,
8080
``:disabled``, ``:checked`` and ``:unchecked`` are available)
8181

8282
Pseudo-elements (``:before``, ``:after``, ``:first-line``,

components/debug/class_loader.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ with a ``DebugClassLoader`` wrapper.
1313
Using the ``DebugClassLoader`` is as easy as calling its static
1414
:method:`Symfony\\Component\\Debug\\DebugClassLoader::enable` method::
1515

16-
use Symfony\Component\ClassLoader\DebugClassLoader;
16+
use Symfony\Component\Debug\DebugClassLoader;
1717

1818
DebugClassLoader::enable();

components/dependency_injection/advanced.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ using the ``get()`` method::
1717

1818
In some cases, a service *only* exists to be injected into another service
1919
and is *not* intended to be fetched directly from the container as shown
20-
above.
20+
above.
2121

2222
.. _inlined-private-services:
2323

components/security/authentication.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ in) is correct, you can use::
263263

264264
// fetch the Acme\Entity\LegacyUser
265265
$user = ...;
266-
266+
267267
// the submitted password, e.g. from the login form
268268
$plainPassword = ...;
269269

components/templating/helpers/assetshelper.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Asset path generation is handled internally by packages. The component provides
9999
You can also use multiple packages::
100100

101101
use Symfony\Component\Templating\Asset\PathPackage;
102-
102+
103103
// ...
104104
$templateEngine->set(new AssetsHelper());
105105

components/templating/introduction.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ escaper using the
135135
Helpers
136136
-------
137137

138-
The Templating component can be easily extended via helpers. Helpers are PHP objects that
138+
The Templating component can be easily extended via helpers. Helpers are PHP objects that
139139
provide features useful in a template context. The component has
140140
2 built-in helpers:
141141

0 commit comments

Comments
 (0)