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
Upgrading Symfony projects to release 1.2
By Stephane Carrez2009-10-04 19:43:26 3 comments
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";
}
into
$statement = $con->prepare("SELECT ID, VALUE
FROM Dictionary WHERE KEY = ?");
$statement->bindValue(1, $value);
$statement->execute();
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
sfPatternRouting::configureRoute()
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
BasePeer::getmapbuilder()
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.
Tags
- Facelet
- NetBSD
- framework
- Mysql
- generator
- files
- application
- gcc
- ReadyNAS
- Security
- binutils
- ELF
- JSF
- Java
- bacula
- Tutorial
- Apache
- COFF
- collaboration
- planning
- project
- upgrade
- AWA
- C
- EL
- J2EE
- UML
- php
- symfony
- Ethernet
- Ada
- FreeBSD
- Go
- KVM
- MDE
- Proxy
- STM32
- Servlet
- backup
- lvm
- multiprocessing
- web
- Bean
- Jenkins
- release
- OAuth
- ProjectBar
- REST
- Rewrite
- Sqlite
- Storage
- USB
- Ubuntu
- bison
- cache
- crash
- Linux
- firefox
- performance
- interview
Add a comment
To add a comment, you must be connected. Login3 comments
I'm curious if you started getting "A template has not been set" errors? 500 reponse and an exception error?
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.
À propos de! J'ai le même problème! Je vous remercie, un peu comme tous les mis en place et fonctionne encore!