DMZ 1.7.1 (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: DMZ 1.7.1 (DataMapper OverZealous Edition) (/showthread.php?tid=28550) |
DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 08-14-2010 [eluser]OverZealous[/eluser] @kre8ivdesigns Please look again at the message I wrote above. It will give you the answer to the question you are asking. With DMZ, you don't need to worry about the join table - instead think in terms of the relationships. If you are getting other errors, you have something wrong in your configuration. DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 08-15-2010 [eluser]kre8ivdesigns[/eluser] {deleted} DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 08-15-2010 [eluser]kre8ivdesigns[/eluser] Im an idiot just went through line by line and saw I called my has_many the plural of the table. Thanks for the help...... IF you ever need any help with designs let me know. finished function Code: function check_dates($checkin,$checkout) DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 08-15-2010 [eluser]kre8ivdesigns[/eluser] {delete} DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 08-15-2010 [eluser]bee27[/eluser] Hi, I'm relatively new to CodeIgniter and DMZ, but have come across a strange issue, and I'm not sure if its me or a bug... I have models Site and Page. Site can have many Pages, and Pages can have one Site. The pages table has the site_id, rather than a joining table. I run the following code, to get the first page for the site... Code: $page = $s->page->where('order', 0)->where('visible', 1)->get(); and the SQL is ... Code: SELECT `pages`.* ... which is correct. Then I do the following, to get all pages for the site (to build a navigation list) ... Code: $pages = $s->page->where('visible', 1)->get(); ... and the SQL is ... Code: SELECT * ... the where clause for the site_id seems to be missing, so all pages for all sites get returned! Am I doing something wrong, do I need to reset something before running the 2nd query? Strangely if I swap the order of the two calls the 2nd always misses out the site_id where clause. Thanks for any help! DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 08-15-2010 [eluser]kre8ivdesigns[/eluser] Ok I have check availability working, add daily rates, book dates, but the item I need someone smart to help me is to calculate the cost for the reservation Tables Days Table id, day Rates Table id, rate Days_rates id day_id rate_id Days_reservations id day_id reservation_id there are more table but dont think matter. Thanks DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 08-15-2010 [eluser]kre8ivdesigns[/eluser] {Solved my problem} THANKS DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 08-16-2010 [eluser]kre8ivdesigns[/eluser] {solved} Please delete my solved posts sorry DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 08-16-2010 [eluser]Wazzu[/eluser] Filter by related table sum() Hi all, this is my case: - table users (id, name) - table invoices (id, user_id, total) Each user has several invoices I want to select all users where total invoiced is greater than a value, let's put $100 This is my SQL query: Code: SELECT users.*, sum(invoices.total) as invoiced I'm trying with where_related(), but can't get mysql's sum() function working. How should I manage this using DMZ? Thank you all DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 08-16-2010 [eluser]kre8ivdesigns[/eluser] Hmmm.. I am learning this as well but I think the way the relationships go are $i = new Invoice(); $i->where('total >=',100); $i->get(); $i->user->get(); I believe this will give you all the users with invoices over $100. Again I aam a newbie who has been working on this as well. |