[eluser]WanWizard[/eluser]
Do I understand it correctly if I say that you have a many-to-many relationship between User and Order?
In that case your relationship table, that links users to orders, MUST be called Order_users (name of both tables, alphabetical order). You then have two models, one for User and one for Order. You don't need a model for your relationship table.
You then run the query like this:
Code:
$obj = new Order();
// add select and group_by where needed
$obj->include_related('user')->get_by_id($order_id);
You update fields in the relationship table by using:
Code:
// Create objects
$u = new User();
$u->get_by_id($user_id);
$o = new Order();
$o->get_by_id($order_id);
// update the order quantity to 100
$o->set_join_field($user, 'quantity', 100);