![]() |
Datamapper: Edit relationship - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Datamapper: Edit relationship (/showthread.php?tid=47848) |
Datamapper: Edit relationship - El Forum - 12-24-2011 [eluser]scherman[/eluser] Hi, i am developing a backend, and i am new at Datamapper. I have this: - Class Author (has many articles) - Class Article (has one author) I am working on the article's edition. And i have a problem with the validation The validation of the Article's class is: Code: var $validation = array( In the form i have two fields: - Title (Textbox) - Author (dropdown with the default-index: 0) When i, as application's user, create an article, for example, if i complete the title's field but i leave the author empty (dropdown's index = 0), it returns me the error. But when i am editing an article, if i leave the author's field empty, it doesn't return me an error, and it saves the article with no author. Here is the code of edit's method (only the save's part): Code: $article = new Article(); I hope you can help me, because i got stuck here. Happy christmas =) |