Welcome Guest, Not a member yet? Register   Sign In
Datamapper advanced relationship question
#4

[eluser]WanWizard[/eluser]
Just make an ER diagram, showing all the tables, primary and foreign keys, and their relations. On paper of with some tool. I personally use Visio as it is platform agnostic, but you can also use MySQL Workbench.

From there it's pretty easy to define the models and their relationships.

In your code, you can just chain the relations, it doesn't matter how deep:
Code:
$grandparent->parent->child->grandchild->where('field', 'value')->get();


Messages In This Thread
Datamapper advanced relationship question - by El Forum - 05-15-2012, 10:02 AM
Datamapper advanced relationship question - by El Forum - 05-15-2012, 11:20 AM
Datamapper advanced relationship question - by El Forum - 05-15-2012, 01:21 PM
Datamapper advanced relationship question - by El Forum - 05-15-2012, 02:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB