Get reference table information as well in MANY_MANY relation

Hello,

I have MANY_MANY relation question - how can one get related information AND relation information as well?

What I mean is, I have ‘comments’ relation for a User model:


'comments'=>array(

	self::MANY_MANY, 

	'Comment',

	Comment_reference::tableName().'(profile_id, comment_id)',

	'with'=>'author',

	'index'=>'id',

	'order'=>'comment.post_time DESC',

),

It works well if I need to get comments for a user, but i also need to have Comment_reference row information for each found comment. It’s all because each comment can be related to many users, and Comment_reference (relation table) purpose is not only to serve as foreignKey helper.

So, can it be done via AR? Please help :rolleyes:

One of the most frequent questions - please also try a forum search first (googling might be better than the built in forum search).

I know 2 solutions, here’s one:

http://www.yiiframework.com/forum/index.php?/topic/8011-many-many-how-to-select-some-fields-from-the-link-table/

There’s also a issue here:

http://code.google.com/p/yii/issues/detail?id=1117