Prova detta:
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);
}
Men du behöver inte använda en dataleverantör, använd bara modellen
foreach(Categories::model()->findAll() as $record) {