![]() |
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 - 11-06-2013 [eluser]Unknown[/eluser] Fatal error: Uncaught exception 'Exception' with message 'Unable to call the method "join" on the class Product' in /application/libraries/datamapper.php:1030 when using: Code: $prod = new product; Ive searched long and hard for a solution to this if i cant use active records join method how am i meant to perform a comparrison like this in datamapper. i tried replacing join with: Code: $prod->include_related('containers', '*', TRUE); but this didn't work either DMZ 1.7.1 (DataMapper OverZealous Edition) - El Forum - 03-05-2014 [eluser]elmystica[/eluser] * Bump I have three tables: - products with an id (PK), name, etc ... - brands with an id (PK), brand_label, etc .. - brands_products with an id (PK), product_id, brand_id My product -method: Code: <?php My Brand Method: Code: <?php In my controller, I want to select ALL products where "brand.brand_url" is a certain brand passed along in the URL. Code: $product = new Product(); It gives me a query like this: Code: SELECT products.* FROM products LEFT OUTER JOIN brands_products brands_products ON products.id = brands_products.product_id LEFT OUTER JOIN brands brands ON brands.id = brands_products.brand_id WHERE brands.brand_url = 'gucci' and it returns only one result ... As this is something I will do often, what is the right way to get the correct joins within Datamapper? |