How do you use DataMapper ORM 1.8.1 with super- and sub-type tables? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: How do you use DataMapper ORM 1.8.1 with super- and sub-type tables? (/showthread.php?tid=46620) |
How do you use DataMapper ORM 1.8.1 with super- and sub-type tables? - El Forum - 11-08-2011 [eluser]Unknown[/eluser] Hi guys, I'm converting to CodeIgnitor, and I can't wait to use DataMapper ORM. Woo who! I'm learning how to build relationships, but I can't figure out how to use super- and sub-type tables with DM. I've looked around DM's documentation, searched the forum, and googled for answers, but I can't find any ideas. I'm building a health and wellness website where users have goals. There are several types of goals: exercise goals, nutrient goals, and marker goals. They have attributes in common like "user_id" and "created" columns, but they also have individual data. Here are my tables... Code: goals How do I model those relationships? I'd prefer to keep the super- and sub-type tables because I think it's a more efficient database design. However, I guess the simplest fix would be to repeat the super-type columns in each sub-type table. I can see some of the sub-type tables are simple join/pivot tables (e.g., nutrient_goals). But other tables like marker_goals have extra data (i.e., "direction" column). Any ideas? Thanks for your help! |