Zkuste toto:
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);
}
Nemusíte však používat poskytovatele dat, místo toho použijte model
foreach(Categories::model()->findAll() as $record) {