Relational Query With Through - How To Get Indistinct Results


I’m using Relational Query with through.

My data is like so (in connecting table or "through" table):

id id1 id2

1  1   1

2  1   2

3  1   1

Yii shows only distinct results:

id id1 id2

1  1   1

2  1   2

how can all rows be retrieved? So I need the "indistinct" results. Is there an option or workaround to this?

Thanks a lot!

Can you post the relation config?


'relation' => array(self::HAS_MANY, 'targetModel', array('targetModelId' => 'id'), 'through' => 'connTable'),


$model = $this->loadModel($id, 'Model')->with('relation');


gives back only 2 objects instead of 3.

as I see, a LEFT OUTER JOIN is used in this case. the query itself gives back 3 rows, so it’s good. the problem is somewhere else. as I see, only the primary key of the target table is selected, and that’s where a distinct effect can come into the picture.

somewhere inside a function that deals with the objects, there must be an unwanted (in this case) array_unique function I guess.