This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/UPGRADE-2.1.md
Fabien Potencier 74bc699b27 moved management of the locale from the Session class to the Request class
The locale management does not require sessions anymore.

In the Symfony2 spirit, the locale should be part of your URLs. If this is the case
(via the special _locale request attribute), Symfony will store it in the request
(getLocale()).

This feature is now also configurable/replaceable at will as everything is now managed
by the new LocaleListener event listener.

How to upgrade:

The default locale configuration has been moved from session to the main configuration:

Before:

framework:
    session:
        default_locale: en

After:

framework:
    default_locale: en

Whenever you want to get the current locale, call getLocale() on the request (was on the
session before).
2011-10-08 18:34:49 +02:00

1.2 KiB

UPGRADE FROM 2.0 to 2.1

  • assets_base_urls and base_urls merging strategy has changed

    Unlike most configuration blocks, successive values for assets_base_urls will overwrite each other instead of being merged. This behavior was chosen because developers will typically define base URL's for each environment. Given that most projects tend to inherit configurations (e.g. config_test.yml imports config_dev.yml) and/or share a common base configuration (i.e. config.yml), merging could yield a set of base URL's for multiple environments.

  • moved management of the locale from the Session class to the Request class

    Configuring the default locale:

    Before:

    framework:
      session:
          default_locale: fr
    

    After:

    framework:
      default_locale: fr
    

    Retrieving the locale from a Twig template:

    Before: {{ app.request.session.locale }} After: {{ app.request.locale }}

    Retrieving the locale from a PHP template:

    Before: $view['session']->getLocale() After: $view['request']->getLocale()

    Retrieving the locale from PHP code:

    Before: $session->getLocale() After: $request->getLocale()