diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md
index a5f1f86c00..b5a4c7626d 100644
--- a/UPGRADE-3.0.md
+++ b/UPGRADE-3.0.md
@@ -20,6 +20,13 @@ UPGRADE FROM 2.x to 3.0
`DebugClassLoader`. The difference is that the constructor now takes a
loader to wrap.
+### Config
+
+ * `\Symfony\Component\Config\Resource\ResourceInterface::isFresh()` has been removed. Also,
+ cache validation through this method (which was still supported in 2.8 for BC) does no longer
+ work because the `\Symfony\Component\Config\Resource\BCResourceInterfaceChecker` helper class
+ has been removed as well.
+
### Console
* The `dialog` helper has been removed in favor of the `question` helper.
@@ -90,6 +97,79 @@ UPGRADE FROM 2.x to 3.0
### DependencyInjection
+ * The concept of scopes was removed, the removed methods are:
+
+ - `Symfony\Component\DependencyInjection\ContainerBuilder::getScopes()`
+ - `Symfony\Component\DependencyInjection\ContainerBuilder::getScopeChildren()`
+ - `Symfony\Component\DependencyInjection\ContainerInterface::enterScope()`
+ - `Symfony\Component\DependencyInjection\ContainerInterface::leaveScope()`
+ - `Symfony\Component\DependencyInjection\ContainerInterface::addScope()`
+ - `Symfony\Component\DependencyInjection\ContainerInterface::hasScope()`
+ - `Symfony\Component\DependencyInjection\ContainerInterface::isScopeActive()`
+ - `Symfony\Component\DependencyInjection\Definition::setScope()`
+ - `Symfony\Component\DependencyInjection\Definition::getScope()`
+ - `Symfony\Component\DependencyInjection\Reference::isStrict()`
+
+ Also, the `$scope` and `$strict` parameters of `Symfony\Component\DependencyInjection\ContainerInterface::set()`
+ and `Symfony\Component\DependencyInjection\Reference` respectively were removed.
+
+ * A new `shared` flag has been added to the service definition
+ in replacement of the `prototype` scope.
+
+ Before:
+
+ ```php
+ use Symfony\Component\DependencyInjection\ContainerBuilder;
+
+ $container = new ContainerBuilder();
+ $container
+ ->register('foo', 'stdClass')
+ ->setScope(ContainerBuilder::SCOPE_PROTOTYPE)
+ ;
+ ```
+
+ ```yml
+ services:
+ foo:
+ class: stdClass
+ scope: prototype
+ ```
+
+ ```xml
+
+
+
+ ```
+
+ After:
+
+ ```php
+ use Symfony\Component\DependencyInjection\ContainerBuilder;
+
+ $container = new ContainerBuilder();
+ $container
+ ->register('foo', 'stdClass')
+ ->setShared(false)
+ ;
+ ```
+
+ ```yml
+ services:
+ foo:
+ class: stdClass
+ shared: false
+ ```
+
+ ```xml
+
+
+
+ ```
+
+ * `Symfony\Component\DependencyInjection\ContainerAware` was removed, use
+ `Symfony\Component\DependencyInjection\ContainerAwareTrait` or implement
+ `Symfony\Component\DependencyInjection\ContainerAwareInterface` manually
+
* The methods `Definition::setFactoryClass()`,
`Definition::setFactoryMethod()`, and `Definition::setFactoryService()` have
been removed in favor of `Definition::setFactory()`. Services defined using
@@ -106,12 +186,170 @@ UPGRADE FROM 2.x to 3.0
### Form
+ * The option `options` of the `CollectionType` has been removed in favor
+ of the `entry_options` option.
+
+ * The `cascade_validation` option was removed. Use the `constraints` option
+ together with the `Valid` constraint instead.
+
+ * Type names were removed. Instead of referencing types by name, you must
+ reference them by their fully-qualified class name (FQCN) instead:
+
+ Before:
+
+ ```php
+ $form = $this->createFormBuilder()
+ ->add('name', 'text')
+ ->add('age', 'integer')
+ ->getForm();
+ ```
+
+ After:
+
+ ```php
+ use Symfony\Component\Form\Extension\Core\Type\IntegerType;
+ use Symfony\Component\Form\Extension\Core\Type\TextType;
+
+ $form = $this->createFormBuilder()
+ ->add('name', TextType::class)
+ ->add('age', IntegerType::class)
+ ->getForm();
+ ```
+
+ If you want to customize the block prefix of a type in Twig, you must now
+ implement `FormTypeInterface::getBlockPrefix()`:
+
+ Before:
+
+ ```php
+ class UserProfileType extends AbstractType
+ {
+ public function getName()
+ {
+ return 'profile';
+ }
+ }
+ ```
+
+ After:
+
+ ```php
+ class UserProfileType extends AbstractType
+ {
+ public function getBlockPrefix()
+ {
+ return 'profile';
+ }
+ }
+ ```
+
+ If you don't customize `getBlockPrefix()`, it defaults to the class name
+ without "Type" suffix in underscore notation (here: "user_profile").
+
+ Type extension must return the fully-qualified class name of the extended
+ type from `FormTypeExtensionInterface::getExtendedType()` now.
+
+ Before:
+
+ ```php
+ class MyTypeExtension extends AbstractTypeExtension
+ {
+ public function getExtendedType()
+ {
+ return 'form';
+ }
+ }
+ ```
+
+ After:
+
+ ```php
+ use Symfony\Component\Form\Extension\Core\Type\FormType;
+
+ class MyTypeExtension extends AbstractTypeExtension
+ {
+ public function getExtendedType()
+ {
+ return FormType::class;
+ }
+ }
+ ```
+
+ * The `FormTypeInterface::getName()` method was removed.
+
+ * Returning type instances from `FormTypeInterface::getParent()` is not
+ supported anymore. Return the fully-qualified class name of the parent
+ type class instead.
+
+ Before:
+
+ ```php
+ class MyType
+ {
+ public function getParent()
+ {
+ return new ParentType();
+ }
+ }
+ ```
+
+ After:
+
+ ```php
+ class MyType
+ {
+ public function getParent()
+ {
+ return ParentType::class;
+ }
+ }
+ ```
+
+ * The option `type` of the `CollectionType` has been removed in favor of
+ the `entry_type` option. The value for the `entry_type` option must be
+ the fully-qualified class name (FQCN).
+
+ * Passing type instances to `Form::add()`, `FormBuilder::add()` and the
+ `FormFactory::create*()` methods is not supported anymore. Pass the
+ fully-qualified class name of the type instead.
+
+ Before:
+
+ ```php
+ $form = $this->createForm(new MyType());
+ ```
+
+ After:
+
+ ```php
+ $form = $this->createForm(MyType::class);
+ ```
+
+ * The alias option of the `form.type_extension` tag was removed in favor of
+ the `extended_type`/`extended-type` option.
+
+ Before:
+ ```xml
+
+
+
+ ```
+
+ After:
+ ```xml
+
+
+
+ ```
+
* The option "precision" was renamed to "scale".
Before:
```php
- $builder->add('length', 'number', array(
+ use Symfony\Component\Form\Extension\Core\Type\NumberType;
+
+ $builder->add('length', NumberType::class, array(
'precision' => 3,
));
```
@@ -119,7 +357,9 @@ UPGRADE FROM 2.x to 3.0
After:
```php
- $builder->add('length', 'number', array(
+ use Symfony\Component\Form\Extension\Core\Type\NumberType;
+
+ $builder->add('length', NumberType::class, array(
'scale' => 3,
));
```
@@ -129,7 +369,9 @@ UPGRADE FROM 2.x to 3.0
Before:
```php
- $builder->add('address', 'form', array(
+ use Symfony\Component\Form\Extension\Core\Type\FormType;
+
+ $builder->add('address', FormType::class, array(
'virtual' => true,
));
```
@@ -137,7 +379,9 @@ UPGRADE FROM 2.x to 3.0
After:
```php
- $builder->add('address', 'form', array(
+ use Symfony\Component\Form\Extension\Core\Type\FormType;
+
+ $builder->add('address', FormType::class, array(
'inherit_data' => true,
));
```
@@ -264,12 +508,12 @@ UPGRADE FROM 2.x to 3.0
// ...
}
```
-
+
* The option "options" of the CollectionType has been renamed to "entry_options".
* The option "type" of the CollectionType has been renamed to "entry_type".
- As a value for the option you must provide the fully-qualified class name (FQCN)
- now as well.
+ As a value for the option you must provide the fully-qualified class name (FQCN)
+ now as well.
* The `FormIntegrationTestCase` and `FormPerformanceTestCase` classes were moved form the `Symfony\Component\Form\Tests` namespace to the `Symfony\Component\Form\Test` namespace.
@@ -317,8 +561,8 @@ UPGRADE FROM 2.x to 3.0
* The `Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList` class has been removed in
favor of `Symfony\Component\Form\ChoiceList\ArrayChoiceList`.
-
- * The `TimezoneType::getTimezones()` method was removed. You should not use
+
+ * The `TimezoneType::getTimezones()` method was removed. You should not use
this method.
* The `Symfony\Component\Form\ChoiceList\ArrayKeyChoiceList` class has been removed in
@@ -365,11 +609,11 @@ UPGRADE FROM 2.x to 3.0
}
}
```
-
+
* In Symfony 2.7 a small BC break was introduced with the new choices_as_values
option. In order to have the choice values populated to the html value attribute
you had to define the choice_value option. This is now not any more needed.
-
+
Before:
```php
@@ -389,9 +633,9 @@ UPGRADE FROM 2.x to 3.0
},
));
```
-
+
After:
-
+
```php
$form->add('status', ChoiceType::class, array(
'choices' => array(
@@ -400,7 +644,7 @@ UPGRADE FROM 2.x to 3.0
'Ignored' => Status::IGNORED,
)
));
- ```
+ ```
* The `request` service was removed. You must inject the `request_stack`
service instead.
@@ -647,6 +891,11 @@ UPGRADE FROM 2.x to 3.0
### Security
+ * The `AbstractVoter` class was removed in favor of the new `Voter` class.
+
+ * The `VoterInterface::supportsClass` and `supportsAttribute` methods were
+ removed from the interface.
+
* The `Resources/` directory was moved to `Core/Resources/`
* The `key` settings of `anonymous`, `remember_me` and `http_digest` are
@@ -779,6 +1028,10 @@ UPGRADE FROM 2.x to 3.0
* The `Translator::setFallbackLocale()` method has been removed in favor of
`Translator::setFallbackLocales()`.
+ * The `getMessages()` method of the `Symfony\Component\Translation\Translator`
+ class was removed. You should use the `getCatalogue()` method of the
+ `Symfony\Component\Translation\TranslatorBagInterface`.
+
### Twig Bridge
* The `twig:lint` command has been deprecated since Symfony 2.7 and will be
@@ -1308,15 +1561,25 @@ UPGRADE FROM 2.x to 3.0
Yaml::parse(file_get_contents($fileName));
```
+### WebProfiler
+
+ * The `profiler:import` and `profiler:export` commands have been deprecated and
+ will be removed in 3.0.
+
+ * All the profiler storages different than `FileProfilerStorage` have been
+ removed. The removed classes are:
+
+ - `Symfony\Component\HttpKernel\Profiler\BaseMemcacheProfilerStorage`
+ - `Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage`
+ - `Symfony\Component\HttpKernel\Profiler\MemcacheProfilerStorage`
+ - `Symfony\Component\HttpKernel\Profiler\MongoDbProfilerStorage`
+ - `Symfony\Component\HttpKernel\Profiler\MysqlProfilerStorage`
+ - `Symfony\Component\HttpKernel\Profiler\PdoProfilerStorage`
+ - `Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage`
+ - `Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage`
+
### Process
* `Process::setStdin()` and `Process::getStdin()` have been removed. Use
`Process::setInput()` and `Process::getInput()` that works the same way.
* `Process::setInput()` and `ProcessBuilder::setInput()` do not accept non-scalar types.
-
-### Config
-
- * `\Symfony\Component\Config\Resource\ResourceInterface::isFresh()` has been removed. Also,
- cache validation through this method (which was still supported in 2.8 for BC) does no longer
- work because the `\Symfony\Component\Config\Resource\BCResourceInterfaceChecker` helper class
- has been removed as well.