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 t
.id
[…] FROM foobarTopics
t
LEFT OUTER JOIN foobar
postId
ON (postId
.topicId
=t
.id
)
So I tried some relations like this :
'userId'=>array(forumPosts::HAS_ONE, 'User','id'),
But I always obtain :
ON (postId
.topicId
=t
.id
)
where I expect :
ON (postId
.topicId
=postId
.id
)
Any suggestions ?