Skip to content

Commit

Permalink
Merge branch '2.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Oct 8, 2015
2 parents 1b91720 + f8c9ce3 commit 0e3f25b
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 18 deletions.
6 changes: 4 additions & 2 deletions components/options_resolver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,8 @@ that, you can write normalizers. Normalizers are executed after validating an
option. You can configure a normalizer by calling
:method:`Symfony\\Component\\OptionsResolver\\OptionsResolver::setNormalizer`::

use Symfony\Component\OptionsResolver\Options;

// ...
class Mailer
{
Expand All @@ -436,7 +438,7 @@ option. You can configure a normalizer by calling
{
// ...

$resolver->setNormalizer('host', function ($options, $value) {
$resolver->setNormalizer('host', function (Options $options, $value) {
if ('http://' !== substr($value, 0, 7)) {
$value = 'http://'.$value;
}
Expand All @@ -462,7 +464,7 @@ if you need to use other options during normalization::
public function configureOptions(OptionsResolver $resolver)
{
// ...
$resolver->setNormalizer('host', function ($options, $value) {
$resolver->setNormalizer('host', function (Options $options, $value) {
if (!in_array(substr($value, 0, 7), array('http://', 'https://'))) {
if ('ssl' === $options['encryption']) {
$value = 'https://'.$value;
Expand Down
7 changes: 3 additions & 4 deletions components/routing/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ your autoloader to load the Routing component::

.. note::

Be careful when using ``$_SERVER['REQUEST_URI']``, as it may include
any query parameters on the URL, which will cause problems with route
matching. An easy way to solve this is to use the HttpFoundation component
as explained :ref:`below <components-routing-http-foundation>`.
The :class:`Symfony\\Component\\Routing\\RequestContext` parameters can be populated
with the values stored in ``$_SERVER``, but it's easier to use the HttpFoundation
component as explained :ref:`below <components-routing-http-foundation>`.

You can add as many routes as you like to a
:class:`Symfony\\Component\\Routing\\RouteCollection`.
Expand Down
14 changes: 11 additions & 3 deletions components/translation/custom_formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ will save a few lines::

class MyFormatDumper extends FileDumper
{
protected function format(MessageCatalogue $messages, $domain = 'messages')
public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array())
{
$output = '';

Expand All @@ -102,7 +102,16 @@ will save a few lines::
}
}

The :method:`Symfony\\Component\\Translation\\Dumper\\FileDumper::format`
.. sidebar:: Format a message catalogue

.. versionadded:: 2.8
The ability to format a message catalogue without dumping it was introduced in Symfony 2.8.

In some cases, you want to send the dump contents as a response instead of writing them in files.
To do this, you can use the ``formatCatalogue`` method. In this case, you must pass the domain argument,
which determines the list of messages that should be dumped.

The :method:`Symfony\\Component\\Translation\\Dumper\\FileDumper::formatCatalogue`
method creates the output string, that will be used by the
:method:`Symfony\\Component\\Translation\\Dumper\\FileDumper::dump` method
of the FileDumper class to create the file. The dumper can be used like any other
Expand All @@ -116,4 +125,3 @@ YAML file are dumped into a text file with the custom format::

$dumper = new MyFormatDumper();
$dumper->dump($catalogue, array('path' => __DIR__.'/dumps'));

4 changes: 2 additions & 2 deletions cookbook/controller/upload_file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ in the ``Product`` entity::
Note that the type of the ``brochure`` column is ``string`` instead of ``binary``
or ``blob`` because it just stores the PDF file name instead of the file contents.

Then, add a new ``brochure`` field to the form that manage the ``Product`` entity::
Then, add a new ``brochure`` field to the form that manages the ``Product`` entity::

// src/AppBundle/Form/ProductType.php
namespace AppBundle\Form;
Expand Down Expand Up @@ -133,7 +133,7 @@ Finally, you need to update the code of the controller that handles the form::

// Update the 'brochure' property to store the PDF file name
// instead of its contents
$product->setBrochure($filename);
$product->setBrochure($fileName);

// ... persist the $product variable or any other work

Expand Down
11 changes: 7 additions & 4 deletions cookbook/security/remember_me.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ the session lasts using a cookie with the ``remember_me`` firewall option:
default:
# ...
remember_me:
key: "%secret%"
secret: "%secret%"
lifetime: 604800 # 1 week in seconds
path: /
# by default, the feature is enabled by checking a
Expand All @@ -48,7 +48,7 @@ the session lasts using a cookie with the ``remember_me`` firewall option:
<!-- 604800 is 1 week in seconds -->
<remember-me
key="%secret%"
secret="%secret%"
lifetime="604800"
path="/" />
<!-- by default, the feature is enabled by checking a checkbox
Expand All @@ -68,7 +68,7 @@ the session lasts using a cookie with the ``remember_me`` firewall option:
'default' => array(
// ...
'remember_me' => array(
'key' => '%secret%',
'secret' => '%secret%',
'lifetime' => 604800, // 1 week in seconds
'path' => '/',
// by default, the feature is enabled by checking a
Expand All @@ -82,7 +82,10 @@ the session lasts using a cookie with the ``remember_me`` firewall option:
The ``remember_me`` firewall defines the following configuration options:

``key`` (**required**)
``secret`` (**required**)
.. versionadded:: 2.8
Prior to Symfony 2.8, the ``secret`` option was named ``key``.

The value used to encrypt the cookie's content. It's common to use the
``secret`` value defined in the ``app/config/parameters.yml`` file.

Expand Down
2 changes: 1 addition & 1 deletion reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ This determines whether cookies should only be sent over secure connections.
cookie_httponly
...............

**type**: ``boolean`` **default**: ``false``
**type**: ``boolean`` **default**: ``true``

This determines whether cookies should only be accessible through the HTTP
protocol. This means that the cookie won't be accessible by scripting
Expand Down
4 changes: 2 additions & 2 deletions reference/configuration/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Each part will be explained in the next section.
remember_me:
token_provider: name
key: someS3cretKey
secret: someS3cretKey
name: NameOfTheCookie
lifetime: 3600 # in seconds
path: /foo
Expand Down Expand Up @@ -227,7 +227,7 @@ Each part will be explained in the next section.
domain: ~
handlers: []
anonymous:
key: 4f954a0667e01
secret: 4f954a0667e01
switch_user:
provider: ~
parameter: _switch_user
Expand Down

0 comments on commit 0e3f25b

Please sign in to comment.