Coba ini:
public function returnCategoryNames()
{
$dataProvider= new CActiveDataProvider('Categories');
$dataProvider->setPagination(false);
//$count = $dataProvider->totalItemCount();
$names = array();
foreach($dataProvider->getData() as $record) {
$names[] = $record->name;
}
return array_unique($names);
}
Namun Anda tidak perlu menggunakan penyedia data, cukup gunakan modelnya
foreach(Categories::model()->findAll() as $record) {