Access field from composite key table

Hi, I have an orders table and a products table, linked by a composite key table that links products to an order. The thing is that I want to store a static price and a quantity with each of the instances of a product belonging to an order (ie. each record in the composite key table).

I have a many to many relationship between the orders and the products defined using this code:


'orders'=>array(self::MANY_MANY, 'Orderprod','tbl_orderprod(oid, prod_id)')

The thing is that the orderprod table also has a price and a quantity along with a product ID and an order ID and I can’t work out how to access that price and quantity.

Thanks in advance for any help you can offer :)

Any help with this one?

i think you should avoid many-many relationship whenever possible.

create an intermediary table between order and products, you can then store the price and qty in that table.

Hey

You can use aliases, described here.