Issue with CActiveRecord findAll

I have been scouring docs, examples…all say the same thing. findAll should return an array of results, however when I do it I get an object. Inside of my Location controller, I am calling:




$dealers = Dealer::model()->findAll();



Which I would expect an array of all dealers back, however I get:


Array

(

    [0] => Dealer Object

        (

            [_md:CActiveRecord:private] => CActiveRecordMetaData Object

                (

                    [tableSchema] => CMysqlTableSchema Object

                        (

                            [schemaName] => 

                            [name] => dealer

                            [rawName] => `dealer`

                            [primaryKey] => id

                            [sequenceName] => 

                            [foreignKeys] => Array

                                (

                                )

 

                            [columns] => Array

I am a Yii noob, so please excuse my ignorance.

Jim

You are getting back an array of results, but the results are model objects themselves. In your case, an array of Dealer model objects.

So,


$dealers[0]

would be a single dealer object. For example, if your dealer table has a firstname column, you could access this attribute of the first dealer object returned in the result set via:


$dealers[0]->firstname;

Awesome, thanks so much!!!