public function getGroupedCategories() { $connection = Yii::app()->db; $sql='SELECT c.id, c.name, (Select name from linkcategory WHERE id = c.parent) AS `group` FROM linkcategory c WHERE c.parent > 0 ORDER BY c.parent, c.name'; $t = $connection->createCommand($sql)->queryAll(); return $t; }
dropDownList($model, 'category', CHtml::listData( $model->getGroupedCategories(), 'id', 'name', 'group') ); ?>
No comments:
Post a Comment