-
Notifications
You must be signed in to change notification settings - Fork 46
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
Implement easy N:N save #393
Comments
Old content, removed |
I refactored the MToM functions I have yesterday. Idea is still the same, create 1 line functions for each model like:
Implementation of MToMfunctions currently is:
|
I'm following this, keep this up, and together with some of my own ideas this should be implemented after I'm finished with Actions. Thanks! |
needs some |
how about |
in some persistences, there may NOT BE the id field accessible through get(). I don't want code to rely on |
With entity design, we should cascade |
Hi there,
as I am using lots of MToM relations in my project, I thought a bit about a native atk4\data MToM implementation.
Ok, first lets get a good example: Students and Lessons.
A Student can have many Lessons, a Lesson can have many Students.
The only solution for mapping this I know so far is to have an extra Model which stores the relations. Like:
What I am aiming for is to directly add and remove relations by passing either id or object.
Passing id:
Passing Object:
And of course having the same for removal and checking if the relation exists
When traversing, we'd usually like the get the lessons of a student, not the StudentToLesson records.
Like:
So how could a MToM relation be defined in model?
What about (In Student's init()):
What do others think about this possible usage?
The text was updated successfully, but these errors were encountered: