Upgrading Symfony projects to release 1.2

By Stephane Carrez 3 comments

Symfony is a PHP framework for building web application. I have two projects that use Symfony 1.1 and I wanted to upgrade to the new 1.2 release. This article lists some issues that I found and

I had two projects to upgrade on my desktop running Ubuntu 8. The upgrade process is described in Upgrading Projects from 1.1 to 1.2 but even if you follow it, this is really not easy.

Symfony Installation

First, I had to remove a previous symfony installation:

 sudo pear uninstall symfony/symfony

For some reasons, I had still the Propel plugin installed, so I've removed what remains with the command;

 $ sudo rm -rf /usr/share/php/symfony         

Then, I've installed the new Symfony version with pear:

 $ sudo pear install symfony/symfony-1.2.3    

(The Symfony installation is described in Installation 1.2).

Upgrade to 1.2

After Symfony installation, I've started to migrate my applications to the new version. You have to run these commands in each project:

 $ php symfony project:upgrade1.2
 $ php symfony propel:build-model

The prope:build-forms command failed because I had to remove old plugins and update the sfGuardPlugin:

 $ symfony plugin:install sfGuardPlugin
 $ php symfony propel:build-forms
 $ php symfony propel:build-filters

Then clear Symfony cache (the sudo was necessary because some files are owned by www-data user)

 $ sudo php symfony cc

Problems and fixes

Now come the issues!!!. You have to check you application and fix each problem. Unlike Ada or Java, there is no compilation check so every change of API is only detected when you execute the code.

After upgrading, I got this error:

 Fatal error: Call to undefined method DebugPDOStatement::setInt()
  in /home/.../lib/model /AssertViewerPager.php on line 35

This is due to the upgrade of Propel from 1.2 to 1.3. Propel is now using PHP Data Objects, which is a very good thing. The following must be changed:

 $statement = $con->prepareStatement("SELECT ID, VALUE 
                                       FROM Dictionary WHERE KEY = ?");
 $statement->setString(1, $value);
 $rs = $statement->executeQuery();
 while($rs->next()) {
   print "ID: " . $rs->getString("ID") . "  VALUE: " 
           . $rs->getString("VALUE") . "\n";


 $statement = $con->prepare("SELECT ID, VALUE 
                                        FROM Dictionary WHERE KEY = ?");
 $statement->bindValue(1, $value);
 while ($row = $statement->fetch()) {
   print "ID: " . $row['ID'] . "  VALUE: " . $row['VALUE'] . "\n";

After fixting the database issues, I found another cryptic error:

 Catchable fatal error: Argument 1 passed to
   must be an instance of sfRoute, string given,
  called in /usr/share/php/symfony/routing/
   sfPatternRouting.class.php on line 245 
 and defined in /usr/share/php/symfony/routing 
  /sfPatternRouting.class.php on line 256

It was caused by the sfGuardPlugin which was not updated correctly. I had to remove it and install it from scratch.

Another error caused by the migration:

 Fatal error: Call to undefined method 
  in /home/.../lib/model /om/
  BaseLogEmitterPeer.php on line 66

To solve this, I had to remove the 'om' directory and rebuild the model with:

 symfony propel:build-model

There could be other issues that I've not reported... In any case, making sure that everything works after the upgrade is painful.

Add a comment

To add a comment, you must be connected. Login


Lawrence Krubner on 2009-04-21 07:07:58 said:

I'm curious if you started getting "A template has not been set" errors? 500 reponse and an exception error?

Lawrence Krubner on 2009-04-21 06:27:08 said:

Thanks much for writing this. I just upgraded from 1.1 to 1.2. These issues were driving me crazy till I found your article.

Fallon on 2009-02-02 22:14:54 said:

À propos de! J'ai le même problème! Je vous remercie, un peu comme tous les mis en place et fonctionne encore!