Skip to content
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

Error saving many to many relations #63

Closed
teeli opened this issue Jan 12, 2015 · 3 comments
Closed

Error saving many to many relations #63

teeli opened this issue Jan 12, 2015 · 3 comments

Comments

@teeli
Copy link

teeli commented Jan 12, 2015

I followed this example using Silverstripe 3.1.8: https://github.com/UndefinedOffset/SortableGridField/blob/master/docs/ManyManyExample.md

All I get is the following error:

[User Error] Sort column OrderKey must be an Int, column is of type
GET /admin/pages/edit/show/1
Line 167 in /var/www/default/sortablegridfield/code/forms/GridFieldSortableRows.php

If I manually change the sort order in the DB to something else than 0, it works, but when I add new items to the grid, the value always defaults to 0.

@UndefinedOffset
Copy link
Owner

Could you post your implementation that is causing this issue? You can strip out all but the relevant stuff ($many_many, $many_many_extraFields and the implementation line in getCMSFields).

@UndefinedOffset
Copy link
Owner

Also I have a thought, do you per-chance have the gridfield named differently than the many many relationship? If so try making it match see if that fixes the issue (I suspect it will).

@teeli
Copy link
Author

teeli commented Jan 16, 2015

Ah, yes. The gridfield was named "Artist" and the relationship was "Artists". Changed both to plural and now it works.

Thanks for the help! Should've seen that typo :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants