Categories
symfony

Ok, so Doctrine.. Part 2

As we announced in our previous post we’ve decided to start using Doctrine instead of Propel.
The first steps in this direction are not about starting the new project though. We would like to see how simple would be to replace Propel with Doctrine in very simple project (like 2-3 simple DB tables).

It’s good that this process is already started and some steps are described in this Wiki article:

http://trac.symfony-project.org/wiki/ConvertingPropelProjectToDoctrine

But honestly not everything looks so cloudless. We were awared that Doctrine uses different schema syntax but it’s getting painful when you need to generate schema from existing DB. So if you have project with schema files described in plugins (e.g. sfGuardPlugin, etc) – you’ll have to generate new schema for Doctrine from existing DB and then slice this schema.yml (notice that Doctrine uses for it confiig/doctrine/schema.yml not confiig/schema.yml) into separate schemas for each plugin manually. Agree that if you have big project with lot of plugins this will be tricky.

So don’t forget to look into the Doctrine schema syntax before you’ll start doing that, e.g. here:

http://www.symfony-project.org/blog/2008/06/16/getting-started-with-doctrine-and-symfony-1-1

We are continuing to look into migration of existing project procedure and will keep you up-to-dated.
So far popular message for our command:

./symfony doctrine:build-all-load –no-confirmation

is

>> doctrine creating databases
>> doctrine generating model classes

No yml schema found in /www/project/cache/tmp, /www/project/config/doctrine

We have doctrine schemas described in plugins (not in /config/doctrine), but it’s strange anyway. In Propel we used to use this approach – all DB schemas were defined in separate plugins. Are we forced to add something to main doctrine/schema.yml (so far the file is empty)? I guess no but don’t see the answer yet.