So here is my code, if I replace the 3rd param (’_sizes’) with one of the table columns, I will get that column. From what I understand this is how it is to be done but it’s just returning Null values.
private $_sizes;
public function showGroupSize()
{
$groupSizes = GroupSizes::model()->findAll();
$list = CHtml::listData($groupSizes,'id', '_sizes');
var_dump($list);
return $list;
}
public function getSizes()
{
return $this->height.'x'.$this->width;
}
It works if I use an anonymous function though.
public function showGroupSize()
{
$groupSizes = GroupSizes::model()->findAll();
$list = CHtml::listData($groupSizes,'id', function ($sizes){return $sizes->height.'x'.$sizes->width;});
return $list;
}
public function getSizes()
{
return "'".$this->height.' x '.$this->width."'";
}