-
Notifications
You must be signed in to change notification settings - Fork 418
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
Clearing and re-adding related objects #418
Comments
Part of the methods (
You should use |
Ok, that makes more sense. However, I get the same result doing it that way. |
Presuming the cross reference table is called Friendships, I can resolve the issue by adding the following line to the start.
Then re-adding all the friends.
Would be nice if Propel handled the cross reference table though. |
Isn't it an issue for the behavior itself? |
Lets say you have a many to many relationship with with Person and Friend.
You can add these to a person object and save it.
Works fine. However, if I then clear off all the friends, and re-add them.
Presuming I am using PersonId/FriendId as the primary key on the cross reference table, I will get an error.
I think Propel should manage this a little more intelligently. Either by deleting the existing cross reference records before trying to add the new ones, or by knowing what cross references are in there already so it doesn't try and duplicate them.
The use case for this is having a form with a series of checkboxes to indicate relationships - hence why you need to clear all the relationships out and then re-add them.
The text was updated successfully, but these errors were encountered: