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.

Comments

much easier than i thought!
Looks good ! What about the compatibility with Symfony 1.2 ? I'm asking because if there is no problem, why Doctrine 1.1 is not on 1.2.2 ?
@Sylvain: 1.1 isn't stable. 1.1 RC1 was released about 1 hour ago...
@Sylvain 1.3 will use Doctrine 1.1. 1.2 cannot switch to 1.1 because of backward compatibility.
It's seems to not work because symfony autoload.
This isn't happening for everything. It is an odd behavior. Can you try the fix suggested here: http://trac.symfony-project.org/ticket/5741

Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.