I need to get a couple of Students from the database, and I have their primary keys in a comma-separated string.
Normally using SQL it would be something like:
You can use findAllByAttributes method also:
findAllByAttributes
$a=array(1,2,3,4); $model = Student::model()->findAllByAttributes(array("id"=>$a));