I have below written code in my controller, and the data is being used for the purpose of active dropdown. but when i run the code, drop down doesn’t show any entry. i believe this function is returning an empty array. can you please point out where i am going wrong?
tblCategories is defined in the relations function of (brand)model class for many many relationship between category and brand.
Thanks in advance
in controller:
public function getCategoryOptions()
{
$model = new Brand;
$categoryArray = CHtml::listData($model->tblCategories,'brand_code','index');
return $categoryArray;
}
in form:
<?php echo $form->dropDownList($model,'category_code', $this->getCategoryOptions()); ?>
in model:
'tblCategories' => array(self::MANY_MANY, 'Category', 'tbl_category_brand_assign(brand_code, category_code)'),