Yii Framework Forum: Yii - Mongodb Collections Data In Cgridview - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii - Mongodb Collections Data In Cgridview Rate Topic: ****- 1 Votes

#1 User is offline   Ayyanar 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 24-December 13

Posted 13 January 2014 - 04:36 AM

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 ???
0

#2 User is offline   chandran 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 488
  • Joined: 08-October 12
  • Location:Austria

Posted 13 January 2014 - 05:33 AM

Hi,Please check this line.. is this correct?$cc->findAllByAttributes($cc->attributes),
Thanks
chandran nepolean

My own extension:
http://www.yiiframew...sion/ejqueryte/

My wiki
http://www.yiiframew...checkboxcolumn/

If it work dont hesitate to click +1 button
0

#3 User is offline   Ayyanar 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 24-December 13

Posted 13 January 2014 - 05:41 AM

Hi thanks for your reply, i removed this line still same error comes...wat to do???
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users