incorrect documentation?

Looking at the class reference for 1.1 at the findAll() method. The documentation claims that the method returns an array. I then return the results of findAll() to a custom function and load the function as part of the data of activeDropDownList(). Now I get an error and I know why I get the error. Because findAll() returned an Object. :-[ Why is the documentation claiming that findAll() returns an array. Am I missing anything or misunderstanding anyting?



I think so, because findAll() certainly returns an array (both the CActiveRecord and CActiveFinder versions). What is your custom function doing?

it returns an array of objects on success

my custom function just returns the result of findAll()

Are you running it through CHtml::listData() before passing it to your activeDropDownList?

Hi, yes I am and it’s working…but it is not working without running it through listData() :)

Right, just to clarify: findAll() returns an array of objects. CHtml::listData() returns an associative value=>text array (or an array of such arrays if $groupField is set). dropDownList doesn’t know what to do with an array of objects. So, the documentation is correct :)

brilliant. thanks for clarifying this.