Yii Relation Data Issue With Hasmany

Currently we have two tables.

Locations and Addresses

Locations are a 1 to many relation to addresses on addresses.location_id.

We are trying to output all addresses related to a specific location in the cgridview:


<?php $this->widget('zii.widgets.grid.CGridView', array(








    			'name' => 'address',

    			'value' => 'implode("<br>",CHtml::listData($data->addresses(),"id","address"))',

    			'filter' => CHtml::activeTextField($location, 'address'),

    			'type' => 'html',






    )); ?>

model (locations.php)

public function search()


    		// Warning: Please modify the following code to remove attributes that

    		// should not be searched.

    		$criteria=new CDbCriteria;

    		$criteria->together = true;

    		$criteria->with = array('addresses');





    		return new CActiveDataProvider($this, array(




Is there a better way of going about getting the address data rather then imploding the $data->addresses function?