-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
default sort error on mongodb dataProvider #19019
Comments
I fixed it and put a pull request |
yii2 not require mongodb, fix it in https://github.com/yiisoft/yii2-mongodb |
Yes, @jarooghe where is this |
@bizley id marked as default sort colum , when not sort option exist on url params , |
but i my suggestion it is not related to yii2-monodb |
Hmm, ok, could you provide your configuration of DataProvider that causes that problem? |
@bizley , @WinterSilence
and have search Model called HotelsSearch that have search() method
in addition ,
instead we can fix it in the framework core ( error is on farmework core ). |
Ok, this is the piece of information that was missing and the cause of that. This looks directly connected to #19018 |
@bizley i tried to clear the bug , but you treid hard to link that for sun,moon,math,laravel ,... |
@jarooghe you try change it not only for mongodb, it's not right way |
What steps will reproduce the problem?
when use mongodb dataProvider , beacause of mongodb have not "id" colums as default , so we get error
Undefined index: id
What is the expected result?
What do you get instead?
replace these 2 line on
vendor/yiisoft/yii2/data/Sort.php Line 232 , Line 233
$definition = $this->attributes[$attribute]??'_id ';
$columns = $definition[$direction === SORT_ASC ? 'asc' : 'desc'] ?? 'asc';
Additional info
The text was updated successfully, but these errors were encountered: