Question

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.  
Was it helpful?

Solution

Upgrade information

Read the upgrade guides in symfony/symfony github repository:

There are also changelogs in the repository:

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)

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top