arogachev / yii2-sortable

Sortable ActiveRecord for Yii 2 framework
Other
17 stars 9 forks source link

Use with yii\mongodb\ActiveRecord #30

Open antdel opened 7 years ago

antdel commented 7 years ago

Is there any workaround in order to use this behavior with MongoDB based ActiveRecord?

I'm getting this error in Chrome network tab when using any of the control buttons in sortable column of GridView.

"Valid ActiveRecord model class must be specified in order to find model."

I tried to bypass the above error by changing the SortController->beforeAction() in order to check also for yii\mongodb\ActiveRecord, but then I am getting the following error:

"Calling unknown method: yii\mongodb\ActiveQuery::addSelect()"

So it seems to me that the addSelect() method is not implemented in mongodb ActiveQuery and prevents using the behavior with mongo (but works fine with yii\db\ActiveRecord).

Any ideas?

arogachev commented 7 years ago

@antdel Initially it was not designed for using with MongoDB. but it's a good idea to add support for it. I'll try to add it soon.