I built a custom function in my model and return the raw data: function(){ ... $connection=Yii::app()->db; $…