• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.