I came across the following problem.
I intended to use the CActiveForm.dropDownList() method
in a form where I'm collecting user data.
As stated in the reference guide , the first parameter of dropDownList()
should be the data model.
Beeing unaware , I used something like this :
Unfortunatelly , I got the error : get_class() expects parameter 1 to be object, array given
OK , I see , findAll() , returns an array and dropDownList is expecting a CModel class.
How else could I retrieve data from the model ?
Is there an alternative to findAll , which returns a Cmodel class ?
I'm stuck.
I intended to use the CActiveForm.dropDownList() method
in a form where I'm collecting user data.
echo $form->dropDownList($myModel,'SearchDeadline',$some_list);
As stated in the reference guide , the first parameter of dropDownList()
should be the data model.
Beeing unaware , I used something like this :
$myModel=MyModel::model()->findAll('ID=:ID',array(':ID'=>'55'));Unfortunatelly , I got the error : get_class() expects parameter 1 to be object, array given
OK , I see , findAll() , returns an array and dropDownList is expecting a CModel class.
How else could I retrieve data from the model ?
Is there an alternative to findAll , which returns a Cmodel class ?
I'm stuck.