2011-10-08 17:29:31 +01:00
|
|
|
UPGRADE FROM 2.0 to 2.1
|
|
|
|
=======================
|
|
|
|
|
|
|
|
* assets_base_urls and base_urls merging strategy has changed
|
|
|
|
|
2012-01-17 09:53:31 +00:00
|
|
|
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.
|
2011-10-08 17:29:31 +01:00
|
|
|
|
2011-10-05 10:09:51 +01:00
|
|
|
* moved management of the locale from the Session class to the Request class
|
|
|
|
|
2012-01-17 09:53:31 +00:00
|
|
|
Configuring the default locale:
|
2011-10-05 10:09:51 +01:00
|
|
|
|
2012-01-17 09:53:31 +00:00
|
|
|
Before:
|
2011-10-05 10:09:51 +01:00
|
|
|
|
2012-01-17 09:53:31 +00:00
|
|
|
framework:
|
|
|
|
session:
|
|
|
|
default_locale: fr
|
2011-10-05 10:09:51 +01:00
|
|
|
|
2012-01-17 09:53:31 +00:00
|
|
|
After:
|
2011-10-05 10:09:51 +01:00
|
|
|
|
2012-01-17 09:53:31 +00:00
|
|
|
framework:
|
|
|
|
default_locale: fr
|
2011-10-05 10:09:51 +01:00
|
|
|
|
2012-01-17 09:53:31 +00:00
|
|
|
Retrieving the locale from a Twig template:
|
2011-10-05 10:09:51 +01:00
|
|
|
|
2012-01-17 09:53:31 +00:00
|
|
|
Before: `{{ app.request.session.locale }}` or `{{ app.session.locale }}`
|
|
|
|
After: `{{ app.request.locale }}`
|
2011-10-05 10:09:51 +01:00
|
|
|
|
2012-01-17 09:53:31 +00:00
|
|
|
Retrieving the locale from a PHP template:
|
2011-10-05 10:09:51 +01:00
|
|
|
|
2012-01-17 09:53:31 +00:00
|
|
|
Before: `$view['session']->getLocale()`
|
|
|
|
After: `$view['request']->getLocale()`
|
2011-10-05 10:09:51 +01:00
|
|
|
|
2012-01-17 09:53:31 +00:00
|
|
|
Retrieving the locale from PHP code:
|
2011-10-05 10:09:51 +01:00
|
|
|
|
2012-01-17 09:53:31 +00:00
|
|
|
Before: `$session->getLocale()`
|
|
|
|
After: `$request->getLocale()`
|
2012-01-12 18:15:35 +00:00
|
|
|
|
|
|
|
* Method `equals` of `Symfony\Component\Security\Core\User\UserInterface` has
|
|
|
|
moved to `Symfony\Component\Security\Core\User\EquatableInterface`.
|
|
|
|
|
2012-01-17 09:53:31 +00:00
|
|
|
You have to change the name of the `equals` function in your implementation
|
|
|
|
of the `User` class to `isEqualTo` and implement `EquatableInterface`.
|
|
|
|
Apart from that, no other changes are required to make it behave as before.
|
|
|
|
Alternatively, you can use the default implementation provided
|
|
|
|
by `AbstractToken:hasUserChanged` if you do not need any custom comparison logic.
|
|
|
|
In this case do not implement the interface and remove your comparison function.
|
|
|
|
|
|
|
|
Before:
|
|
|
|
|
|
|
|
class User implements UserInterface
|
|
|
|
{
|
|
|
|
// ...
|
|
|
|
public function equals(UserInterface $user) { /* ... */ }
|
|
|
|
// ...
|
|
|
|
}
|
|
|
|
|
|
|
|
After:
|
|
|
|
|
|
|
|
class User implements UserInterface, EquatableInterface
|
|
|
|
{
|
|
|
|
// ...
|
|
|
|
public function isEqualTo(UserInterface $user) { /* ... */ }
|
|
|
|
// ...
|
|
|
|
}
|
|
|
|
|
2012-01-16 23:52:13 +00:00
|
|
|
* Form children aren't automatically validated anymore. That means that you
|
|
|
|
explicitely need to set the `Valid` constraint in your model if you want to
|
|
|
|
validate associated objects.
|
2012-01-17 09:53:31 +00:00
|
|
|
|
|
|
|
If you don't want to set the `Valid` constraint, or if there is no reference
|
|
|
|
from the data of the parent form to the data of the child form, you can
|
|
|
|
enable BC behaviour by setting the option "cascade_validation" to `true` on
|
2012-01-16 23:46:26 +00:00
|
|
|
the parent form.
|
|
|
|
|
2012-01-30 09:57:14 +00:00
|
|
|
* Changed implementation of choice lists
|
|
|
|
|
|
|
|
ArrayChoiceList was replaced. If you have custom classes that extend
|
2012-01-30 10:10:25 +00:00
|
|
|
this class, you can now extend SimpleChoiceList.
|
|
|
|
|
|
|
|
Before:
|
|
|
|
|
2012-01-30 12:36:34 +00:00
|
|
|
class MyChoiceList extends ArrayChoiceList
|
2012-01-30 10:10:25 +00:00
|
|
|
{
|
|
|
|
protected function load()
|
|
|
|
{
|
|
|
|
parent::load();
|
|
|
|
|
|
|
|
// load choices
|
|
|
|
|
|
|
|
$this->choices = $choices;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
After:
|
|
|
|
|
2012-01-30 12:36:34 +00:00
|
|
|
class MyChoiceList extends SimpleChoiceList
|
2012-01-30 10:10:25 +00:00
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
// load choices
|
|
|
|
|
|
|
|
parent::__construct($choices);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
If you need to load the choices lazily - that is, as soon as they are
|
|
|
|
accessed for the first time - you can extend LazyChoiceList instead.
|
|
|
|
|
|
|
|
class MyChoiceList extends LazyChoiceList
|
|
|
|
{
|
|
|
|
protected function loadChoiceList()
|
|
|
|
{
|
|
|
|
// load choices
|
|
|
|
|
|
|
|
return new SimpleChoiceList($choices);
|
|
|
|
}
|
|
|
|
}
|
2012-01-30 09:57:14 +00:00
|
|
|
|
|
|
|
PaddedChoiceList, MonthChoiceList and TimezoneChoiceList were removed.
|
|
|
|
Their functionality was merged into DateType, TimeType and
|
|
|
|
TimezoneType.
|
|
|
|
|
|
|
|
EntityChoiceList was adapted. The methods `getEntities`,
|
|
|
|
`getEntitiesByKeys`, `getIdentifier` and `getIdentifierValues` were
|
|
|
|
removed/made private. Instead of the first two, you can now use
|
|
|
|
`getChoices` and `getChoicesByValues`. For the latter two, no
|
|
|
|
replacement exists.
|
|
|
|
|
2012-01-16 23:46:26 +00:00
|
|
|
* The strategy for generating the HTML attributes "id" and "name"
|
2012-01-23 17:58:56 +00:00
|
|
|
of choices in a choice field has changed
|
|
|
|
|
|
|
|
Instead of appending the choice value, a generated integer is now appended
|
|
|
|
by default. Take care if your Javascript relies on that. If you can
|
|
|
|
guarantee that your choice values only contain ASCII letters, digits,
|
|
|
|
letters, colons and underscores, you can restore the old behaviour by
|
|
|
|
setting the option "index_strategy" of the choice field to
|
|
|
|
`ChoiceList::COPY_CHOICE`.
|
2012-01-16 23:46:26 +00:00
|
|
|
|
|
|
|
* The strategy for generating the HTML attributes "value" of choices in a
|
2012-01-23 17:58:56 +00:00
|
|
|
choice field has changed
|
|
|
|
|
|
|
|
Instead of using the choice value, a generated integer is now stored.
|
2012-01-24 10:59:07 +00:00
|
|
|
Again, take care if your Javascript reads this value. If your choice field
|
|
|
|
is a non-expanded single-choice field, or if the choices are guaranteed not
|
|
|
|
to contain the empty string '' (which is the case when you added it manually
|
|
|
|
or when the field is a single-choice field and is not required), you can
|
|
|
|
restore the old behaviour by setting the option "value_strategy" to
|
|
|
|
`ChoiceList::COPY_CHOICE`.
|
2012-01-24 00:23:01 +00:00
|
|
|
|
|
|
|
* In the template of the choice type, the structure of the "choices" variable
|
|
|
|
has changed
|
|
|
|
|
2012-01-30 09:57:14 +00:00
|
|
|
"choices" now contains ChoiceView objects with two getters `getValue`
|
|
|
|
and `getLabel` to access the choice data. The indices of the array
|
2012-01-24 00:23:01 +00:00
|
|
|
store an index whose generation is controlled by the "index_generation"
|
|
|
|
option of the choice field.
|
|
|
|
|
|
|
|
Before:
|
|
|
|
|
|
|
|
{% for choice, label in choices %}
|
|
|
|
<option value="{{ choice }}"{% if _form_is_choice_selected(form, choice) %} selected="selected"{% endif %}>
|
|
|
|
{{ label }}
|
|
|
|
</option>
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
After:
|
|
|
|
|
|
|
|
{% for choice in choices %}
|
|
|
|
<option value="{{ choice.value }}"{% if _form_is_choice_selected(form, choice) %} selected="selected"{% endif %}>
|
|
|
|
{{ choice.label }}
|
|
|
|
</option>
|
|
|
|
{% endfor %}
|
2012-01-28 12:37:13 +00:00
|
|
|
|
|
|
|
* In the template of the collection type, the default name of the prototype
|
|
|
|
field has changed from "$$name$$" to "__name__"
|
|
|
|
|
|
|
|
For custom names, no dollars are prepended/appended anymore. You are advised
|
|
|
|
to prepend and append double underscores wherever you have configured the
|
|
|
|
prototype name manually.
|
|
|
|
|
|
|
|
Before:
|
|
|
|
|
|
|
|
$builder->add('tags', 'collection', array('prototype' => 'proto'));
|
|
|
|
|
|
|
|
// results in the name "$$proto$$" in the template
|
|
|
|
|
|
|
|
After:
|
|
|
|
|
|
|
|
$builder->add('tags', 'collection', array('prototype' => '__proto__'));
|
|
|
|
|
|
|
|
// results in the name "__proto__" in the template
|