1.8 KiB
1.8 KiB
UPGRADE FROM 3.1 to 3.2
FrameworkBundle
- The
Controller::getUser()
method has been deprecated and will be removed in Symfony 4.0; typehint the security user object in the action instead.
DependencyInjection
- Calling
get()
on aContainerBuilder
instance before compiling the container is deprecated and will throw an exception in Symfony 4.0.
Form
-
Calling
isValid()
on aForm
instance before submitting it is deprecated and will throw an exception in Symfony 4.0.Before:
if ($form->isValid()) { // ... }
After:
if ($form->isSubmitted() && $form->isValid()) { // ... }
FrameworkBundle
- The service
serializer.mapping.cache.doctrine.apc
is deprecated. APCu should now be automatically used when available.
Validator
-
Tests\Constraints\AbstractConstraintValidatorTest
has been deprecated in favor ofTest\ConstraintValidatorTestCase
.Before:
// ... use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest; class MyCustomValidatorTest extends AbstractConstraintValidatorTest { // ... }
After:
// ... use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; class MyCustomValidatorTest extends ConstraintValidatorTestCase { // ... }
-
Setting the strict option of the
Choice
Constraint tofalse
has been
deprecated and the option will be changed totrue
as of 4.0.// ... use Symfony\Component\Validator\Constraints as Assert; class MyEntity { /** * @Assert\Choice(choices={"MR", "MRS"}, strict=true) */ private $salutation; }