Creating Dynamic Attributes For Mongo Collection

I am trying to create dynamic model class for Mongo Collection and populate data in Cgridview (using YIIMongodbsuite extension)

Getting Column from MySQL DB:


$sql="SELECT name FROM CRM_Field Where crm_base_contact_id = ".$base;

$names =Yii::app()->db->createCommand($sql)->query()-> readAll();

Accessing Model in view:


$cc = new ContactCollection($names);// Passing dynamic column names to Model 

 $criteria = new EMongoCriteria;

 $criteria->crm_base_contact_id('==', $base);

 $cc->setDbCriteria($criteria);


 <?php $this->widget('zii.widgets.grid.CGridView', array(

    'id' =>'BCImported-grid',

    'dataProvider' => $cc->search(false),

    'columns' => $names,

        )); ?>

ContactCollection Model :


<?php

class ContactCollection extends EMongoDocument

    {

        public $dyn_fields;

   public function __construct ($names) {

        $this->dyn_fields = $names;


    }


  public function getCollectionName()

      {

        return 'cartoons';

      }


    /**

     * @return array validation rules for model attributes.

     */

    public function rules()

    {

        $allMembers = implode(', ', array_keys($this->dyn_fields));

        return array(

            array($allMembers, 'required'),

        );

    }


    public function attributeLabels()

    {

       return $this->dyn_fields;

    }

    }

In grid im getting empty rows(shown in attacment) but number of row count is correct,how to populate rows with mongo data,where im doing wrong???