gii/mongoCRUD/templates/default/admin.php

214 views
Skip to first unread message

stutteringp0et

unread,
Feb 17, 2011, 3:21:23 PM2/17/11
to YiiMongoDbSuite
Line 53:
'dataProvider'=>new EMongoDocumentDataProvider($model->search(),
array(

should be:
'dataProvider'=>new EMongoDocumentDataProvider($model, array(

Dariusz Górecki

unread,
Feb 17, 2011, 3:52:43 PM2/17/11
to yiimong...@googlegroups.com
No, it should be 'dataProvider'=>$model->search()

I changed it recently, to match default Yii AR behavior

canni

W dniu 17.02.2011 21:21, stutteringp0et pisze:

stutteringp0et

unread,
Feb 17, 2011, 4:46:46 PM2/17/11
to YiiMongoDbSuite
EMongoDocumentDataProvider::__construct wants a $modelClass (text or
object) as the first argument, while $model->search() returns a
EMongoDocumentDataProvider object.

I was getting an error on r=project/admin when $model->search() was
present:
PHP Fatal error: Call to a member function getDbCriteria() on a non-
object in /var/www/yii/trackstar/protected/extensions/YiiMongoDbSuite/
EMongoDocumentDataProvider.php on line 73

Removing the ->search() method resolves the error, but I'm unable to
search/filter.

stutteringp0et

unread,
Feb 17, 2011, 4:49:04 PM2/17/11
to YiiMongoDbSuite
$model->search()->model works

and I'm able to search/filter.

stutteringp0et

unread,
Feb 17, 2011, 4:51:39 PM2/17/11
to YiiMongoDbSuite
I realize that I'm the only other member of this group (for now), so I
hope you don't feel annoyed by my frequent posts.

nickelstar

unread,
Mar 22, 2011, 4:43:09 PM3/22/11
to YiiMongoDbSuite
I too had this same issue. After debugging, it appears the trouble
maker is line 1284 in EMongoDocument.php which is the return line of
the search() method:

return new EMongoDocumentDataProvider($this);

I changed it to:

return $this;

And the issue was resolved. The problem is that the admin.php view
passes $model->search() as the first parameter to the
EMongoDocumentDataProvider constructor. But $model->search is itself
returning an EMongoDocumentDataProvider. So the object is being passed
as a parameter to it's own constructor. The constructor is really
wanting an EMongoDocument object which is what the above fix provides.

max

unread,
Apr 25, 2011, 11:33:54 PM4/25/11
to YiiMongoDbSuite
I can confirm this. I had the same problem.

$model->search()->model fixed it.... which is weird.

max

unread,
Apr 25, 2011, 11:35:40 PM4/25/11
to YiiMongoDbSuite
Actually, it only fixed the fatal error problem... I'm still not
getting any results....

Also, keep running into problems w/ MongoId not being a string... If
anyone has insight into this, I will write the code and contribute
back. I just don't have time to investigate it atm.

Dariusz Górecki

unread,
May 2, 2011, 2:04:22 PM5/2/11
to yiimong...@googlegroups.com
Hey,

this is the admin template and EMongoDocument::search() method problem,
i know about it, but I have no reasoably solution for it now.

canni

W dniu 26.04.2011 05:35, max pisze:

Reply all
Reply to author
Forward
0 new messages