Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.  
like image 568
stefun Avatar asked Jun 19 '13 11:06

stefun


2 Answers

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)
like image 190
Nicolai Fröhlich Avatar answered Dec 07 '22 20:12

Nicolai Fröhlich


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
like image 33
Emii Khaos Avatar answered Dec 07 '22 22:12

Emii Khaos