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
Bug in pivot sorting #4335
Comments
How are you making the call on the pivot? I use October and just built a plugin with pivot sorting.
Maybe try changing your line to: |
Might be a fix you're looking for #4432 |
@Cleanse , using @w20k please note that the example above does not use the Relation widget, which your pull request is fixing. It uses the |
I'll try and get you an example out tomorrow. My project does not use the Backend, so that could be why. I'll test a backend example similar to your setup. The project I created that has working pivot sorting: https://github.com/Cleanse/events/blob/master/models/Match.php |
This issue will be closed and archived in 3 days, as there has been no activity in the last 30 days. If this issue is still relevant or you would like to see action on it, please respond and we will get the ball rolling. |
@vakopian What exactly are you trying to do here? I think the issue is due to the fact that you are not defining a |
I'm having the same problem, using the sorting work but I cannot attach (add button) any model in the relation widget
The order is displayed as it should in the back and in frontend. |
You're having exactly the same issue as me, hope someone finds a workaround it gets sorted soon |
I've found some workaround fot displaying the relation window in my case the
I'm using a column from the relation not the pivot table. When trying to search I'm getting similar SQL error
|
Confirmed this issue has been fixed by 5f8a545 @bennothommo this is yours to close and claim the bounty! |
Replication instructions:
Without code in 5f8a545 an exception is thrown. With the code, the nefarious sort order appears to be removed and no error occurs |
Thanks heaps @daftspunk :D |
@vakopian Would you mind testing the fix provided above, and releasing the bounty if this has sorted out the issue for you? |
Sorry if this is the wrong place to ask but how do we apply these fixes I manually went into the backend files and changed them to match the ones in the above commit. Once I had done that I now can't view the list within the backend at all way before because I get a chance to click the add button within the relation controller. Error: "Call to undefined method Backend\Widgets\Lists::getSortColumn()" Am I on the wrong build number (458) or is applying this fix not as simple as copy pasting the correct cod from the commit? |
@woshj The |
@bennothommo Thanks mate! Now I can sort the columns although you still can't use the Add Button as mentioned by OP, adamo and myself
Unless I still have something wrong with my setup but it all seems okay to me and the sorting fix has been applied so I think it's working correctly |
Unfortunately this bug is still not fixed in the latest build 466. I just tried my test project and got the same error as @woshj. This bug was a major blocker for the project I was attempting with octobercms and I spent many hours trying to fix it myself in the core, without success. This endeavor has proved to me that the enormous complexity in this framework is just not worth the effort (a bug like this should have been relatively easy to fix, but turned out to be next to impossible to debug and isolate). And thus, sadly, I have since abandoned the framework. |
… modes. Fixes #4335 (comment), refs: 5f8a545
@vakopian I would encourage you to give it another try, I've tested 24f87ae and it solves the problem with the add button too. The framework is not that complicated, but like any framework you have to invest time into understanding how everything fits together in order to solve complex issues with edge cases. |
Description:
Two models called
Product
andCategory
that are in a many-to-many relationship with a pivot table. The pivot table has a columnrelation_sort_order
, which should be used to sort the products within a category. ThebelongsToMany
inCategory
is set like this:When trying to create a new category, the following error is received:
where it's trying to run the following sql:
So the
order
clause is clearly added to the wrong query.Steps To Reproduce:
Product
andCategory
.RelationController
inCategory
model:belongsToMany
inCategory
model:Categories
andProducts
controllers, and add theRelationController
toCategories
, with standardwhere
config_relation.yaml
is also standard:The text was updated successfully, but these errors were encountered: