Monday, January 19, 2009

Call the expert: Using a custom version of Doctrine

Now that the release of Doctrine 1.1 right around the corner their has been a bit of noise about how users can use 1.1 instead of the default bundled 1.0.
With sfDoctrinePlugin it is easy to swap out the version of Doctrine used by simply changing one configuration value.
Below you will find an example of how you can configure sfDoctrinePlugin to use a different version of Doctrine, for example 1.1.
First we need to check out the version of Doctrine we want to use into lib/vendor/doctrine:$ cd lib/vendor
$ svn co http://svn.doctrine-project.org/branches/1.1/lib doctrine
Now we can configure the sfDoctrinePlugin to use that version of Doctrine instead of the one that comes bundled with the plugin. In your ProjectConfiguration::setup() method you need to change the value of the sfDoctrinePlugin_doctrine_lib_path with sfConfig, like the following:public function setup()
{
sfConfig::set('sfDoctrinePlugin_doctrine_lib_path', sfConfig::get('sf_lib_dir') . '/vendor/doctrine/Doctrine.php');
}
Now you can enjoy the great features of Doctrine 1.1 without too much work. You can check out what is new in Doctrine 1.1 by reading the upgrade file.

No comments: