Welcome Guest, Not a member yet? Register   Sign In
Datamapper: more direct access to join fields
#2

[eluser]WanWizard[/eluser]
In more complex cases with join fields I usually split the relation.

So instead of having a many-many between A en B, I create a many to one between A and AB, and a many to one between B and AB (where AB is your relationship table).

Create a model for your relationship table, and you can query it like any normal relation.

Downside of this is that you have to either use deep relations (AB->B) when querying B from A, or define two relations, one from A to B (many to many) and one from A to AB (many to one).


Messages In This Thread
Datamapper: more direct access to join fields - by El Forum - 03-19-2012, 05:19 PM
Datamapper: more direct access to join fields - by El Forum - 03-20-2012, 02:05 AM
Datamapper: more direct access to join fields - by El Forum - 03-20-2012, 09:13 AM
Datamapper: more direct access to join fields - by El Forum - 03-20-2012, 01:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB