How do you pass array parameter to $params in DB condition?


Does Yii have a way to pass array parameter to $params when building a condition?

Regarding my case, I have something like:

$user2groups = User2group::model()



                        ->findAll('project.ID = :project_id AND t.REF_USER IN (:members)',

                            array(':project_id' => $project_id, ':members'=>implode(',', $members));

I’m trying to pass array of member ids (last row). The last try was to pass string with merged ids.

Still not working - returns only one row.

Any suggestions?


This is how to do it,

You have to supply the member id(s) array itself to the



$criteria = new CDbCriteria;



$user2groups = User2group::model()




Thanks a lot, bro!

This is working as it should.