Symfony - FOSUserBundle Profile view does not work after update to Symfony 2.8 - symfony

I have upgraded my Symfony project from version 2.6 to 2.8 and after that, I receive an error 500 when I request the profile view. The error is:
Error: Call to a member function has() on null
Stack Trace in vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php at line 350 -
*/
public function getUser()
{
if (!$this->container->has('security.token_storage')) {
throw new \LogicException('The SecurityBundle is not registered in your application.');
}
When I run composer show -i, I see the next list:
You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.
doctrine/annotations v1.4.0 Docblock Annotations Parser
doctrine/cache v1.6.2 Caching library offering a...
doctrine/collections v1.4.0 Collections Abstraction li...
doctrine/common v2.7.3 Common Library for Doctrin...
doctrine/dbal v2.5.13 Database Abstraction Layer
doctrine/doctrine-bundle 1.8.1 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle 1.3.2 Symfony Bundle for Doctrin...
doctrine/inflector v1.1.0 Common String Manipulation...
doctrine/instantiator 1.0.5 A small, lightweight utili...
doctrine/lexer v1.0.1 Base library for a lexer t...
doctrine/orm v2.5.14 Object-Relational-Mapper f...
friendsofsymfony/jsrouting-bundle 1.5.3 A pretty nice way to expos...
friendsofsymfony/oauth-server-bundle 1.5.0 Symfony2 OAuth Server Bundle
friendsofsymfony/oauth2-php 1.2.2 OAuth2 library
friendsofsymfony/user-bundle dev-master 9b3be01 Symfony FOSUserBundle
incenteev/composer-parameter-handler v2.1.2 Composer script handling y...
ircmaxell/password-compat v1.0.4 A compatibility library fo...
jdorn/sql-formatter v1.2.17 a PHP SQL highlighting lib...
jms/aop-bundle 1.3.0 Adds AOP capabilities to S...
jms/cg 1.2.0 Toolset for generating PHP...
jms/di-extra-bundle 1.9.1 Allows to configure depend...
jms/metadata 1.6.0 Class/method/property meta...
jms/parser-lib 1.0.0 A library for easily creat...
jms/security-extra-bundle dev-master c4a5dda Enhances the Symfony2 Secu...
knplabs/knp-snappy v1.0.4 PHP5 library allowing thum...
knplabs/knp-snappy-bundle v1.5 Easily create PDF and imag...
kriswallsmith/assetic v1.4.0 Asset Management for PHP
liuggio/ExcelBundle v2.1.0 This is a Symfony2 Bundle ...
monolog/monolog 1.23.0 Sends your logs to files, ...
paragonie/random_compat v2.0.11 PHP 5.x polyfill for rando...
phpoffice/phpexcel 1.8.1 PHPExcel - OpenXML - Read,...
phpoption/phpoption 1.5.0 Option Type for PHP
phpunit/php-code-coverage 1.2.18 Library that provides coll...
phpunit/php-file-iterator 1.4.5 FilterIterator implementat...
phpunit/php-text-template 1.2.1 Simple template engine.
phpunit/php-timer 1.0.9 Utility class for timing
phpunit/php-token-stream 1.2.2 Wrapper around PHP's token...
phpunit/phpunit 3.7.38 The PHP Unit Testing frame...
phpunit/phpunit-mock-objects 1.2.3 Mock Object library for PH...
psr/log 1.0.2 Common interface for loggi...
sensio/distribution-bundle v2.3.22 The base bundle for the Sy...
sensio/framework-extra-bundle v3.0.29 This bundle provides a way...
sensio/generator-bundle v2.5.3 This bundle generates code...
stripe/stripe-php v3.23.0 Stripe PHP Library
swiftmailer/swiftmailer v5.4.9 Swiftmailer, free feature-...
symfony/assetic-bundle v2.8.2 Integrates Assetic into Sy...
symfony/monolog-bundle v2.12.1 Symfony MonologBundle
symfony/polyfill-intl-icu v1.7.0 Symfony polyfill for intl'...
symfony/polyfill-mbstring v1.7.0 Symfony polyfill for the M...
symfony/polyfill-php54 v1.7.0 Symfony polyfill backporti...
symfony/polyfill-php55 v1.7.0 Symfony polyfill backporti...
symfony/polyfill-php56 v1.7.0 Symfony polyfill backporti...
symfony/polyfill-php70 v1.7.0 Symfony polyfill backporti...
symfony/polyfill-util v1.7.0 Symfony utilities for port...
symfony/security-acl v2.8.0 Symfony Security Component...
symfony/swiftmailer-bundle v2.6.7 Symfony SwiftmailerBundle
symfony/symfony v2.8.0 The Symfony PHP framework
twig/extensions v1.5.1 Common additional features...
twig/twig v1.35.0 Twig, the flexible, fast, ...
willdurand/jsonp-callback-validator v1.1.0 JSONP callback validator.
I have been researching for hours and I havenĀ“t found useful information about this error.
Thanks in advance.

The issue is in your Controllers. Probably they extend Symfony\Component\ DependencyInjection\ContainerAware that is deprecated since version 2.8. Remove this and use Symfony\ Component\DependencyInjection\ ContainerAwareTrait.
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
class MyBundleController implements ContainerAwareInterface {
use ContainerAwareTrait;
/**
* #Route("/", name="_index")
* #Template()
*/
public function indexAction() {
var_dump($this->container);
return array();
}
}
Edit: Cerad was right in the comments:
there is is not need to rewrite your existing controllers that extend from Controller. The problem is in third party bundles like the FOSUserBundle which do not extend from Controller. However, even they should still work under 2.8 or at least give different errors.
It should work in either case.
References:
ref 1
Symfony 2.8 upgrade -> ContainerAwareTrait

Related

Replacement for deprecated Shopware EntityRepositoryInterface is also deprecated

According to Shopware 6.4.13.0 upgrade instructions, EntityRepositoryInterface has been deprecated and should be replaced by EntityRepository. But EntityRepository is also marked as deprecated in my IDE, using the recommended development setup all upgraded to the latest versions:
PhpStorm (2022.1.3 Build #PS-221.5921.28)
Symfony Support plugin 2022.1.230
Shopware plugin 4.4.3
Shopware development setup cloned from github.com/shopware/development
Shopware platform "6.4.9999999.9999999 Developer Version"
loaded and upgraded by psh according to composer.json in development setup:
"require": {
"shopware/platform": "6.4.x#dev || dev-trunk"
Deprecation note in my PhpStorm IDE:
Class 'EntityRepository' is deprecated
class EntityRepository implements EntityRepositoryInterface \Shopware\Core\Framework\DataAbstractionLayer\EntityRepository
Deprecated: 5.6.0
Namespace:
\Shopware\Core\Framework\DataAbstractionLayer\
Source:
development/vendor/shopware/platform/src/Core/Framework/DataAbstractionLayer/EntityRepository.php
How to handle the deprecation and what to use instead of EntityRepositoryInterface that will not be deprecated as well?
How to know if the IDE's deprecation notice can be safely ignored? I suppose that it can be ignored, as the mentioned version number "5.6.0" does not match any current or upcoming Shopware 6 release.
How to turn off misleading deprecation notices in my IDE?
Has been fixed with commit https://github.com/shopware/platform/commit/99cf9093464d679f6abcb91bb68cc4205bc6ccf0
it has now only #final https://github.com/shopware/platform/blob/trunk/src/Core/Framework/DataAbstractionLayer/EntityRepository.php#L29

The field 'usernameCanonical' is not mapped by Doctrine, so it cannot be validated for uniqueness

I am using FOSUserBundle in my Symfony 2.7 project. In the composer.json file the requirement is defined as "friendsofsymfony/user-bundle" : "~2.0#dev". Currently version/commit 45d6f40 (11/03/2015) is installed.
After using composer update the latest version 7abb0ff was installed. After this, I get the following exception when trying to create new users:
The field 'usernameCanonical' is not mapped by Doctrine, so it cannot be validated for uniqueness
Searching for solution for this problem brought up older issues dealing with the same exception (here and here). However I was not able to solve the problem with the solution discussed in these issues.
Issue 1565 proposes to use FOS\UserBundle\Entity\User as BaseUser; instead of FOS\UserBundle\Model\User as BaseUser;. But this solution seems not to be valid for version 2.x. The 2.x documentation says that you should extend from FOS\UserBundle\Model\User, which makes sense since there are no FOS\UserBundle\Entity\... classes anymore.
My User class looks like this:
namespace AppBundle\Entity;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
/**
* This class represents the User entity and extends the FOSBundle base user
* Entity class to be able to use FOSUserBundle to manage the application users.
*
* #ORM\Entity(repositoryClass="AppBundle\Entity\UserRepository")
* #ORM\Table(name="app_user") *
* #ORM\HasLifecycleCallbacks()
*/
class User extends BaseUser {
...
}
In Issue 1638 the solution was to use auto_mapping in the Doctrine configuration. I already did this.
So neither of the existing solutions worked for my. Additional all existing issues to this problem are quite old.
Of course I could simply downgrade back to version/commit 45d6f40. However I would prefer to solve the problem instead of ignoring it :-)
Any other idea how I can solve this?
PS: This is my composer show -i output:
doctrine/annotations v1.2.7 Docblock Annotations Parser
doctrine/cache v1.6.0 Caching library offering an object-oriented API for many cache backends
doctrine/collections v1.3.0 Collections Abstraction library
doctrine/common v2.6.1 Common Library for Doctrine projects
doctrine/dbal v2.4.5 Database Abstraction Layer
doctrine/doctrine-bundle v1.2.0 Symfony DoctrineBundle
doctrine/inflector v1.0.1 Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator 1.0.5 A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm v2.4.8 Object-Relational-Mapper for PHP
friendsofsymfony/http-cache 1.4.0 Tools to manage cache invalidation
friendsofsymfony/http-cache-bundle 1.3.4 Set path based HTTP cache headers and send invalidation requests to your HTTP cache
friendsofsymfony/rest-bundle 1.4.2 This Bundle provides various tools to rapidly develop RESTful API's with Symfony2
friendsofsymfony/user-bundle dev-master 7abb0ff Symfony FOSUserBundle
gremo/buzz-bundle v1.1.0 Symfony Bundle for using the lightweight Buzz HTTP client.
guzzle/guzzle v3.9.3 PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle
jdorn/sql-formatter v1.2.17 a PHP SQL highlighting library
jms/metadata 1.5.1 Class/method/property metadata management in PHP
jms/parser-lib 1.0.0 A library for easily creating recursive-descent parsers.
jms/serializer 1.3.1 Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.
jms/serializer-bundle 1.1.0 Allows you to easily serialize, and deserialize data of any complexity
kriswallsmith/assetic v1.3.2 Asset Management for PHP
kriswallsmith/buzz v0.15 Lightweight HTTP client
leafo/scssphp v0.6.6 scssphp is a compiler for SCSS written in PHP.
moontoast/math 1.1.0 A mathematics library, providing functionality for large numbers
paragonie/random_compat v2.0.2 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phpcollection/phpcollection 0.5.0 General-Purpose Collection Library for PHP
phpoption/phpoption 1.5.0 Option Type for PHP
psr/log 1.0.0 Common interface for logging libraries
sensio/distribution-bundle v2.3.22 The base bundle for the Symfony Distributions
sensio/framework-extra-bundle v2.3.4 This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle v2.3.5 This bundle generates code for you
swiftmailer/swiftmailer v5.4.3 Swiftmailer, free feature-rich PHP mailer
symfony/assetic-bundle v2.7.1 Integrates Assetic into Symfony2
symfony/monolog-bundle v2.8.2 Symfony MonologBundle
symfony/swiftmailer-bundle v2.3.11 Symfony SwiftmailerBundle
symfony/symfony v2.7.7 The Symfony PHP framework
tfox/mpdf-port-bundle 1.3.1 A wrapper for mPDF class which allows to use mPDF in Symfony2 projects
twig/extensions v1.0.1 Common additional features for Twig that do not directly belong in core
twig/twig v1.25.0 Twig, the flexible, fast, and secure template language for PHP
willdurand/jsonp-callback-validator v1.1.0 JSONP callback validator.
willdurand/negotiation 1.5.0 Content Negotiation tools for PHP provided as a standalone library.
Maybe this solve someone problems when you get the error
The field 'usernameCanonical' is not mapped by Doctrine, so it cannot be validated for uniqueness
One cause is using FOS\UserBundle\Model\User as BaseUser and running doctrine schema:update, if you did this you create a table on a database without several columns like username, usernameCanonical, password, etc.
When you want to access to any functionalities of this you get that message.
How to fix:
Dropping table fos_user on database
Change FOS\UserBundle\Model\User as BaseUser
to
FOS\UserBundle\Entity\User as BaseUser
Run php app/console doctrine:schema:update --force

FOSRestBundle & JMSSerializerBundle with symfony 2.7 and PHP 5.5.12

I'd like to add the 2 libraries FOSRestBundle & JMSSerializerBundle to my application built with symfony 2.7 but i encountred this response
Problem 1
- Installation request for friendsofsymfony/rest-bundle dev-master -> satisfiable by friendsofsymfony/rest-bundle[dev-master].
- friendsofsymfony/rest-bundle dev-master requires php ^5.5.9|~7.0 -> your PHP version (5.5.12) overriden by "config.platform.php" version (5.3.9) does not satisfy that requirement.
Problem 2
- Installation request for jms/serializer-bundle dev-master -> satisfiable by jms/serializer-bundle[dev-master].
- jms/serializer-bundle dev-master requires php >=5.4.0 -> your PHP version (5.5.12) overriden by "config.platform.php" version (5.3.9) does not satisfy that requirement.
Notice that PHP version is 5.5.12
I think the problem is the version of this 2 libraries. If yes, What are the versions of FOSRestBundle & JMSSerializerBundle ?
dev-master should never be used as version bound when requiring a package as dependency, except in some specific cases.
Go to https://packagist.org/ then search for the packages you are looking for and use their respective current stable version as version bound for your composer.json's requirement.
Also, in your composer.json, you have a config key containing a platform.php key with 5.3.9 as value. Remove or override this block according to your real PHP version. See Symfony2, composer, your PHP version (5.6.18) overriden by "config.platform.php" version (5.3.9) does not satisfy requirement.
Of course, if the last stable version of one of them isn't compatible with your environment (PHP >= 5.5.9 for friendsofsymfony/rest-bundle), you need to look for an older version supporting your environment (all is available on packagist, and surely on the official documentation of these packages).

The ability to pass file names to the Symfony\Component\Yaml\Yaml::parse method is deprecated

I'm new to Symfony2 and working on it for now nearly 3 weeks.
Things are going well but I have 4 deprecated warning at each page that require doctrine to interact (mapping is done through yaml file), whatever the entity used.
The ability to pass file names to the
Symfony\Component\Yaml\Yaml::parse method is deprecated since version
2.2 and will be removed in 3.0. Pass the YAML contents of the file instead. (4 times)
I don't know what I did wrong, or if there is a problem somewhere I can fix to get rid of the warns.
Thank you for your help !
Just in case, here is the full stacktrace :
Yaml::parse() (called from YamlDriver.php at line 712)
YamlDriver::loadMappingFile() (called from FileDriver.php at line 115)
FileDriver::getElement() (called from YamlDriver.php at line 55)
YamlDriver::loadMetadataForClass() (called from MappingDriverChain.php at line 102)
MappingDriverChain::loadMetadataForClass() (called from ClassMetadataFactory.php at line 116)
ClassMetadataFactory::doLoadMetadata() (called from AbstractClassMetadataFactory.php at line 332)
AbstractClassMetadataFactory::loadMetadata() (called from AbstractClassMetadataFactory.php at line 216)
AbstractClassMetadataFactory::getMetadataFor() (called from EntityManager.php at line 265)
EntityManager::getClassMetadata() (called from DefaultRepositoryFactory.php at line 67)
DefaultRepositoryFactory::createRepository() (called from DefaultRepositoryFactory.php at line 50)
DefaultRepositoryFactory::getRepository() (called from EntityManager.php at line 665)
EntityManager::getRepository() (called from UserManager.php at line 40)
UserManager::__construct() (called from appDevDebugProjectContainer.php at line 1582)
appDevDebugProjectContainer::getFosUser_UserManagerService() (called from Container.php at line 312)
Container::get() (called from appDevDebugProjectContainer.php at line 3632)
appDevDebugProjectContainer::getFosUser_UserProvider_UsernameService() (called from Container.php at line 312)
Container::get() (called from appDevDebugProjectContainer.php at line 3690)
appDevDebugProjectContainer::getSecurity_Authentication_ManagerService() (called from Container.php at line 312)
Container::get() (called from appDevDebugProjectContainer.php at line 2299)
appDevDebugProjectContainer::getSecurity_Firewall_Map_Context_MainService() (called from Container.php at line 312)
Container::get() (called from classes.php at line 2964)
FirewallMap::getListeners() (called from classes.php at line 2606)
Firewall::onKernelRequest()
call_user_func() (called from WrappedListener.php at line 61)
WrappedListener::__invoke()
call_user_func() (called from classes.php at line 1853)
EventDispatcher::doDispatch() (called from classes.php at line 1771)
EventDispatcher::dispatch() (called from TraceableEventDispatcher.php at line 132)
TraceableEventDispatcher::dispatch() (called from HttpKernel.php at line 120)
HttpKernel::handleRaw() (called from HttpKernel.php at line 62)
HttpKernel::handle() (called from ContainerAwareHttpKernel.php at line 69)
ContainerAwareHttpKernel::handle() (called from Kernel.php at line 185)
Kernel::handle() (called from app_dev.php at line 30)
And if needed, the result of composer.phar show --installed
doctrine/annotations v1.2.7 Docblock Annotations Parser
doctrine/cache v1.5.4 Caching library offering an object-oriented API for many cache backends
doctrine/collections v1.3.0 Collections Abstraction library
doctrine/common v2.5.3 Common Library for Doctrine projects
doctrine/dbal v2.5.4 Database Abstraction Layer
doctrine/doctrine-bundle 1.6.2 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle 1.3.0 Symfony Bundle for Doctrine Cache
doctrine/inflector v1.1.0 Common String Manipulations with regard to casing and singular/plural rules.
doctrine/lexer v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm v2.4.8 Object-Relational-Mapper for PHP
friendsofsymfony/user-bundle v1.3.6 Symfony FOSUserBundle
incenteev/composer-parameter-handler v2.1.2 Composer script handling your ignored parameter file
ircmaxell/password-compat v1.0.4 A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash
jdorn/sql-formatter v1.2.17 a PHP SQL highlighting library
monolog/monolog 1.17.2 Sends your logs to files, sockets, inboxes, databases and various web services
paragonie/random_compat v1.2.0 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
psr/log 1.0.0 Common interface for logging libraries
sensio/distribution-bundle v5.0.4 Base bundle for Symfony Distributions
sensio/framework-extra-bundle v3.0.13 This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle v3.0.5 This bundle generates code for you
sensiolabs/security-checker v3.0.2 A security checker for your composer.lock
swiftmailer/swiftmailer v5.4.1 Swiftmailer, free feature-rich PHP mailer
symfony/monolog-bundle v2.8.2 Symfony MonologBundle
symfony/phpunit-bridge v2.8.2 Symfony PHPUnit Bridge
symfony/polyfill-intl-icu v1.1.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring v1.1.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php54 v1.1.0 Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions
symfony/polyfill-php55 v1.1.0 Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions
symfony/polyfill-php56 v1.1.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70 v1.1.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util v1.1.0 Symfony utilities for portability of PHP codes
symfony/security-acl v2.8.0 Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.3.11 Symfony SwiftmailerBundle
symfony/symfony v2.8.2 The Symfony PHP framework
twig/twig v1.24.0 Twig, the flexible, fast, and secure template language for PHP
EDIT
As suggested, I upgraded Doctrine to 2.5, after struggling with some dependancy problems.
Now I have only 2 notices, about stuff from security, which I'm currently working on, based on a deprecated tutorial. Commenting faulty line made notices disappear. Hooray !
As suggested by Cerad, I upgraded to Doctrine 2.5 by editing composer.json, and running composer update.
This generated new notices, but related to security stuff I've written in a deprecated way, easily fixed.
For anyone going through the same problem, be careful in your composer.json, Doctrine 2.5 requires php 5.4, and some config.platform.php was set to 5.3.9 for me, which blocked the update. Edit this too if you want to upgrade.
The ability to pass file names to Yaml::parse() has been removed.
Before: Yaml::parse($fileName);
After: Yaml::parse(file_get_contents($fileName));
source:
https://github.com/symfony/symfony/blob/master/UPGRADE-3.0.md#yaml
Probably you are not using explicity Yaml::parse. It is not a problem until you want to upgrade to 3.0. If you would you can except that change is covered by dependencies (possibly doctrine-bridge). If not you should stick to 2.7 LTS version of Symfony.
I just checked that 2.8 is also LTS. I'm not sure what is the difference.

upgrade from symfony 2.0 to 2.3

I already have running project which is in Symfony 2.0.10. But now I need to upgrade it to Symfony 2.3.I know there is need to change some code to compitable with latest version.Is there any command to upgrade? Or what is the exact procedure to upgrade? Is there any document available?.
Edit:
I put symfony 2.3 composer.json file and while doing php composer.phar update I got this error.
Problem 1
- symfony/symfony v2.3.1 requires symfony/icu >=1.0,<2.0 -> no matching package found.
- symfony/symfony v2.3.0 requires symfony/icu >=1.0,<2.0 -> no matching package found.
- Installation request for symfony/symfony 2.3.* -> satisfiable by symfony/symfony[v2.3.0, v2.3.1].
Edit 2:
First I got this error:
[InvalidArgumentException]
The dist file "app/config/parameters.yml.dist" does not exist. Check your dist-file config or create it.
so I created parameters.yml.dist file.
Now I'm getting
PHP Fatal error: Class 'Symfony\Component\ClassLoader\UniversalClassLoader' not found in /var/www/git/sample/app/autoload.php on line 6
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap handling the post-update-cmd event terminated with an exception
[RuntimeException]
An error occurred when generating the bootstrap file.
Upgrade information
Read the upgrade guides in symfony/symfony github repository:
Upgrade 2.1
Upgrade 2.2
Upgrade 2.3
Upgrade 2.4
Upgrade 2.5
Upgrade 2.6
Upgrade 2.7
Upgrade 3.0
There are also changelogs in the repository:
CHANGELOG-2.2
CHANGELOG-2.3
Backup your project!
Upgrading with composer
Get composer and put the symfony 2.3 standard edition's composer.json into your project root.
Now run composer update with your project's patch as working directory.
-> You will face some exceptions due to breaking changes exceptions. Google will help resolve those :)
Personal experience
In my legacy projects the most noticeable bc break from 2.0 to 2.1 was this one related to the form-builder because I had to update every form.
Before ( 2.0 )
use Symfony\Component\Form\FormBuilder;
public function buildForm(FormBuilder $builder, array $options)
After ( 2.1+ )
use Symfony\Component\Form\FormBuilderInterface;
public function buildForm(FormBuilderInterface $builder, array $options)
Upgrading is in general simple, as you only have to update the version constraints in your composer.json according to the standard distribution and issuing
php composer.phar update
But 2.3 has some backwards compatibility breaks. So read carefully every upgrade document for necessary code changes.
from 2.0 to 2.1
from 2.1 to 2.2
from 2.2 to 2.3

Resources