Prøv dette:
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);
}
Du behøver dog ikke bruge en dataudbyder, i stedet skal du blot bruge modellen
foreach(Categories::model()->findAll() as $record) {