Hi, I am really new to this and I am afraid that is going to show. This should be simple. I am trying to iterate over an array of models.
$dataProviderQuestion=new CActiveDataProvider( 'Question',
// 'Question' is the model
// I am using a CactiveDataProvider because I know how to filter date with it.
array(
'criteria'=>array(
//'condition'=>'is_deprecated=FALSE',
//'order'=>'create_time DESC',
)
)
);
foreach ($dataProviderQuestion->getdate() as $m) {
// $m should be the models?
$items[] = "<label>" . CHtml::checkbox('List[]', 1, array('value' => $count)) . $m->prompt . "</label>";
++$count;
}
On the line with ‘foreach’ I get the error “CActiveDataProvider and its behaviors do not have a method or closure named “getdate”.” But acording to www.yiiframework.com/doc/api/1.1/CActiveDataProvider it does. I think all I need is an array of the models so the foreach loop can go over them. Please help.
Thanks