Display data from two tables in grid with YII framework

3

Hello,

I'm starting to develop web and I'm having a problem working with YII framework 1.

I have in the application a grid that displays: product name, segment, price . All of this data comes from the database in two customer and products tables. The problem is that the grid lists all these items from all registered customers. I have to make the grid display only the products, segment, customer's price logged, and not all.

Tabela_cliente (cod_cliente(PK), nome_cliente,end_cliente)
Tabela_produto(cod_produto(PK),segmento, preço)

I do not know if you have to create a produto_cliente table, where to do this check to enter the data in the grid.

I can not show any code because the company does not allow it for contract reasons.

Does anyone have a help? I know it must be some relationship but where do I do this in my code?

    
asked by anonymous 09.10.2018 / 01:39

1 answer

0

What is the relationship between products and customers? For a many-to-many relationship needs an auxiliary table (customer_product), but if it is a one-to-many relationship you can resolve with a foreign key. >     

07.11.2018 / 16:58