![]() |
[Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - 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: [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) (/showthread.php?tid=18196) |
[Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 06-15-2009 [eluser]bEz[/eluser] Yes....Sir!!!! ![]() Providing a paired code and documented solution should suffice most of the novice users of CI, and will allow more time for you to concentrate on the next round of expansions and updates. I will give the docs a good "re"-read for anything that may be too technical or is not read in laymen's terms. I think that was the main reason for the repeated questions. I dont think a sub-forum was the key at all. p.s. - I had a good feeling that you would have gone with the "include_related" alternate function. ![]() -bEz [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 06-15-2009 [eluser]naren_nag[/eluser] Phil, Superfantabuloustic! It's documentation of this quality that separates the men (or women) from the boys (or girls) :/ cheers [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 06-16-2009 [eluser]warrennz[/eluser] Heya guys Just got a small issue - thought I would post it before I go ripping datamapper apart in case someone can quickly shed some light on my errors.. I have users in a M:M relationship with privileges I can do this, Code: $u = new User(); but I cannot do this Code: $p = new Privileges(); The relation is pretty straight forward, user table with id, privileges table with id, privileges_users table with user_id and privilege_id. The fact it works one way is kinda saying the data setup is correct, I've done a little debugging and get_by_name() is definitely getting a privilege with an id that is present in the relationship table. Any quick thoughts? Thanks [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 06-16-2009 [eluser]NachoF[/eluser] Quote:"privileges_users table with user_id and privilege_id"it also needs an id field. [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 06-16-2009 [eluser]warrennz[/eluser] @NachoF Yes sorry it does have an ID field too. ![]() [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 06-16-2009 [eluser]OverZealous[/eluser] DMZ Updated! Quote:Version 1.3.0: This update brings two big new features. Please download [url="http://www.overzealous.com/dmz/DMZ_1.3.0.zip"]version 1.3.0 here[/url]. [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 06-16-2009 [eluser]OverZealous[/eluser] @warrennz Check out Why does my relationship work from one object, but fail from the other? in the troubleshooting guide. Most likely there is something missing or incorrectly typed on the Priviledges class. Oh, yeah, I forgot to mention that DMZ now has a fairly in-depth set of FAQs! [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 06-16-2009 [eluser]warrennz[/eluser] OK! I found what was causing the issue I'm just unsure of what to do next ![]() I had a look at the parsed has_many() relationships array in the privileges model. Quote: [user] => Array The model is terribly basic, Code: class Privileges extends DataMapper { And again this is the relationship from the user model Quote: [privileges] => Array from Code: class User extends DataMapper { So, privileges has become privilege. To test this I renamed all cases of the plural (filename, class name, method, references to privileges in other models) to a singular and it works fine now. So yea, any ideas on that one? I could define that rest of that relationship for example privileges model var $has_many = array("user" => array('class' => 'user', 'other_field' => 'privileges')); But that of course means the relationship table needs privileges_id instead of privilege_id @OverZelous Does that FAQ still apply? I read it but not 100% sure. Thanks [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 06-16-2009 [eluser]OverZealous[/eluser] @warrennz Basically, you have mis-named your Privileges class. If you read through the docs, you'll see that the model should always be named singularly, ie: Privilege. However, there is a solution that will work most of the time: Hard code your model name into Privileges like this: Code: class Privileges extends DataMapper { I recommend changing the name of the class, if you can, because there are a few other places in DataMapper that might eventually give you trouble down the road. [Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) - El Forum - 06-16-2009 [eluser]Matthew Lanham[/eluser] @OverZealous.com Good work on the new version, and i am so happy you have merged your documentation and download etc that was getting to be a pain in the ass going to 2 different websites, so thanks for that!!!! |