Im trying to populate Cgridview with Mongo data, but getting error "Undefined offset: 0"
Here is my coding,
$sql="SELECT name FROM CRM_Field Where crm_base_contact_id = ".$base;
$names =Yii::app()->db->createCommand($sql)->query()-> readAll();
$mongo = new Mongo( Yii::app()->mongodb->connectionString);
$collection = $mongo->test->crm_contact_tmp;
$mongocol = $mongo->test->crm_contact_tmp->find(array('crm_base_contact_id' => array('$in' => array($base))));
$arrayDataProvider = new CArrayDataProvider (iterator_to_array($mongocol) );
?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id' =>'BCImported-grid',
'dataProvider' =>$arrayDataProvider,
$cc->findAllByAttributes($cc->attributes),
'columns' => $names,
)); ?>
what mistake im doing