views:

156

answers:

2

I have a few simple classes, all extending Doctrine_Record.

Now I want to make a slightly more complex query with Inner Join, not just table data extracting.

I am doing to use DQL, does this oblige me to manually define relation between 2 tables? Should I define this relation class or I better update schema.yml and somehow re-generate class code?

No DQL joins are possible without such explicit relation preparations, right?

+1  A: 

I would regenerate class code. I find its always good practice to use either schema or db as the authoritative source and then just regenerate and/or use migrations. ITs easier to maintain things that way. Same goes for Propel as well as Doctrine.

prodigitalson
+1  A: 

You can add the relation to your .yaml file and then re-generate your classes that way. Here's Doctrine's documentation on relations in Yaml files.

You will need to re-generate your db so Doctrine can add the correct foreign key constraints based on the new relationships. This is relatively simple using the command line Doctrine command and assumes you don't care about losing your data. If you do care about losing data, you should be using Doctrine to manage your migrations for you but that's beyond the scope of your question. You can find more info about the migrations by looking at A Frankel's answer to this question.

Chris Williams