![]() |
DMZ Problem - 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: DMZ Problem (/showthread.php?tid=33248) Pages:
1
2
|
DMZ Problem - El Forum - 08-19-2010 [eluser]7amza[/eluser] Hey, i started using the DMZ library and all goes cute expet i'm encoutring a problem : i have three tables : portals : id - title.. pages : id - portal_id - title.. categories : id - portal_id - title .. the relation between them is like that : each page and category has one portal . and each portal have many categories and pages . so my models is like that: : Code: //Portal.php Code: function cat(){ when i use this method: Code: $page = new page(); Quote:DataMapper Error: 'page' is not a valid parent relationship for Portal. Are your relationships configured correctly?and when i try to get all categories and pages related to portal from the portal i can't gets them ! Code: $portal = new portal(2); Quote:Fatal error: Call to a member function get() on a non-object in G:\AppServ\www\test\application\modules\dir\controllers\home.php on line 21notice : the line 20 works fine alone it gets all categories related to portal 2 . so what's wrong please? DMZ Problem - El Forum - 08-19-2010 [eluser]J Maxwell[/eluser] Your $has_xxx associations are wrong - it needs to reference the singular of the modelname - so 'page' rather than 'pages' like you have. Hope that helps, John DMZ Problem - El Forum - 08-19-2010 [eluser]7amza[/eluser] Hey Max , in my code i wrote 'page' but still the problem exist ! (i corrected the code here too) i don't know what's wrong evenif all code is logic like it is describe in the manual !! DMZ Problem - El Forum - 08-19-2010 [eluser]J Maxwell[/eluser] Does it work if you do: Code: $page = new page(); Trying it from another angle? Do you possibly have a typo in the field in your database? The join field should be singular with _id at the end? Is the code here copied and pasted? DMZ Problem - El Forum - 08-19-2010 [eluser]7amza[/eluser] i tested the code but it doesn't get a result : Code: function index() Code: CREATE TABLE `categories` ( DMZ Problem - El Forum - 08-19-2010 [eluser]J Maxwell[/eluser] Yeah, I can see. Well, I can't. But I'll keep thinking for you. J DMZ Problem - El Forum - 08-19-2010 [eluser]J Maxwell[/eluser] Try changing this: Code: $portal = new portal(2); To this: Code: $portal = new portal(2); Since you can access categories from portal, try originating it from there as well? DMZ Problem - El Forum - 08-19-2010 [eluser]7amza[/eluser] thank you J , really i'm so confused hope someone can help me . DMZ Problem - El Forum - 08-19-2010 [eluser]7amza[/eluser] Quote:and when i try to get all categories and pages related to portal from the portal i can't gets them ! ![]() ![]() ![]() DMZ Problem - El Forum - 08-20-2010 [eluser]7amza[/eluser] any reply guys? |