Monday, January 5, 2009

include calculated data in the model

I have this kind of db structure:

Each Account has many Orders.
Each Order has many OrderProducts.
OrderProduct contains fields like product name, price, quantity.

I want to show at the account view a list of related orders and each
order has a field "amount" which will be the sum of related
orderproducts price * quantity.

Is this possible? Where and how should I put the relation data?

thank you for any help!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: