I am trying to create a grid with yii using three different tables. Here is a rough demonstration of what I am trying to achieve:
Table: Products
prod_id, prod_name
Table: Regions
reg_id, reg_name
Table: Prices
price_id, prod_id, reg_id, price
Products/Regions | Region#1 | Region#2 | ... | Region#N
--------------------------------------------------------
Product#1 | Price#1 | Price#2 | ... | Price#N
Product#2 | Price#1 | Price#2 | ... | Price#N
Product#3 | Price#1 | Price#2 | ... | Price#N
...
Product#N | Price#1 | Price#2 | ... | Price#N
I need to approach this from the products table. I need to be able to search the products. And I don't need to to use GridView, also it would be optimal if I can use it.
I really need recommendation more than anything in this situation. One idea I have is to create a double array of prices and access them and put them in the table $prices[$prod_id][$reg_id]
but this system has to be really optimal and performance plays a huge role. So, I would appreciate if anyone can help me out with this.
Thanks, Gasim