join in query builder

sometimes i need build query and i need two join or more in code (depend on selected item). so i should create joins and concat to other part of query but it doesnt work.

so if i need


$user = Yii::app()->db->createCommand()

->select ...

->from ...

->join (...)

->join (...)

->join (...)

i should create ->join

something like this


$user = Yii::app()->db->createCommand()

->select

->from

foreach ($arrayjoin as $join)

{

echo "$join";

}

how to do this?

another thing is why join doesn’t accept array like where .

so i can have


->join(a array of needed join)

instead of


->join(needed join)

->join(needed join)

Actually join() can accept an array: http://www.yiiframework.com/doc/api/1.1/CDbCommand#setJoin-detail

thank you. only difference between setjoin() and join() is supporting array?

EDIT: it seems setjoin doesnt work in query builder and i get this error:

"Call to a member function queryRow() on a non-object in …"

anyone can help me how to use setJoin() in CDbCriteria or how to use array for join() parameter?