Problem with CActiveDataProvider and CListView

Hi,

I have a mysql table Vehicles containing information, eg. color, body style (only integer).

For this reason I have component contining color and body styles array:




'value in db' => 'Name'






    private $vehicleBodyStyle = array(

        '1' => 'Sedan', '2' => 'SW', '3' => 'Convertible', '4'=> 'Coupe',

        '50' => 'Other'

    );


    private $vehicleColors = array(

        '1' => 'Black', '2' => 'Grey', '3' => 'White', '4'=> 'Green', '5' => 'Red',

        '50' => 'Other'

    );



I’m listing vehicles with Zii CListView.




$this->widget('zii.widgets.CListView', array(

	'dataProvider'=>$vehicles,

        'itemView' => '_vehicle'

)); 



I need to replace indexes 1, 2, 3 with their values.

Should I do this in _vehicle.php view (but don’t know how to pass arrays to this view using CListView) or somehow change CActiveDataProvider returned object before passing to CListView?

You could place your arrays as properties in the model file ( but not as private ). And fetch values from _vehicle like:


$data->vehicleBodyStyle[0]

Thanks!