|How to work with many-to-many entity relations? [message #977737]
||Fri, 09 November 2012 09:32
| André T.
Registered: November 2012
firstly, appologise if I am opening a topic which is already discussed. Unfortunately I haven't found anything related.
Also, I am at a very early stage with Scout, done the tutorial on 3.7 and 3.8 minicm, so far.
When I have the tables with a many to many relationship, I would like to know how to use the AbstactPageWithTable to link the two main tables together. If you could point me in the right direction, it would be highly appreciated.
Hope my short description makes sense.
|Re: How to work with many-to-many entity relations? [message #981113 is a reply to message #977737]
||Mon, 12 November 2012 01:56
| Jeremie Bresson
Registered: November 2010
If I may add a more complex example:
In an outline-based application, you will represent your entities in a tree. A tree is suitable for one to many relations: when you expand one node, you see all related entities.
Lets take this database as example (Source: Oracle MySQL - Sakila)
As you see, you have a many to many relation between films and categories and between films and actors.
When you have fixed one category (resp. one actor), you have many film that belongs to this category (resp.to this actor). A possibility is to add a FilmsTablePage as child page of the CategoriesTablePage (resp. of the ActorsTablePage). In this FilmsTablePage you load only the films that belong to the category (resp. the actor) corresponding to the row in the parent table page.
You get something like this for categories:
And something like this for actors:
This is comparable to:
MiniCRM Tutorial - Write the second page
Now consider the films: for one film, there is many categories and many actors.
A solution is to add a node page for each film. This page contains two table page (one for category and one for actor).
See: MiniCRM Tutorial - Reorganize the tree.
To summarize here the pages tree:
├─Films Table Page
│ └─Film Node Page
│ ├─Actors Table Page
│ └─Categories Table Page
├─Categories Table Page
│ └─Films Table Page
└─Actors Table Page
└─Films Node Page
Do not hesitate to ask question on the forum.
[Updated on: Mon, 12 November 2012 01:57]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02404 seconds