![]() |
How to save relationship in datamapper orm? - 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 to save relationship in datamapper orm? (/showthread.php?tid=46712) |
How to save relationship in datamapper orm? - El Forum - 11-12-2011 [eluser]Unknown[/eluser] Hi all, I have problems trying to save the relationship with the following database and code. Kindly refer to the controller code as that's the area which I have problems saving data. I'm new to the datamapper ORM. DB Code: accounts Models for both Posts and Accounts Code: class Account extends DataMapper { Code: class Post extends DataMapper { Controller Code: class Posts extends CI_Controller { I have a few thoughts in mind. Should I try to create a foreign key in posts table such as account_id instead of using posts_accounts? And even I have managed to save the relationship, how do I extract the data in views? Appreciate any help from anybody who can help me sort this out. |