Kohana 2.3.4 ORM pivot table query

Posted by anthony on Stack Overflow See other posts from Stack Overflow or by anthony
Published on 2010-04-09T18:52:25Z Indexed on 2010/04/09 18:53 UTC
Read the original article Hit count: 494

Filed under:
|
|
|
|

I'm trying to query a pivot table with Kohana's ORM and I'm wondering if there is a built in function I'm missing. Currently I only have 2 models setup for the tables "categories" and "products". There is a pivot table "categories_products", but I don't need a model for it when inserting data with this:

$product = ORM::factory('product');
$product->add(ORM::factory('category', $addCat));

However, I can't figure out how to query it without creating a model for it. The "join_table" function only returns the name of the pivot table (which I thought selected the table at first). If you can save data to the pivot table without a model, it seems to me that you should be able to retrieve data in a similar way. Any ideas?

© Stack Overflow or respective owner

Related posts about kohana

Related posts about php