Joining a table from joined results

Hi @ all !

I’m trying to do a relational query that works fine under PHPmyadmin.

In that query I’m joining “forum posts” to a main table called “forum topics”.

Each post has one user_id so I’m wondering if CActiveRecord can do a such query.

As I tested CActiverecord always joins using the main id :

Example :

using foobarTopics::model->findAll(…

I’ll obtain :

SELECT […] FROM foobarTopics t LEFT OUTER JOIN foobar postId ON (

So I tried some relations like this :

'userId'=>array(forumPosts::HAS_ONE, 'User','id'),

But I always obtain :

ON (

where I expect :

ON (

Any suggestions ?

oops, problem solved.

a foreign key was missing