Dear Yii-developers,
I have a problem regarding a relational query from which I want to show the results in a Grid View. I’ve set up my relations in the corresponding model, so it’s easy to access the corresponding results. The problem is that I don’t know and can not find any examples how to display this in a Grid View, because the relational query does not return a DataProvider.
My system consist of an Order, who has a has many relation with Colbert and Pantalon. I use the following easy to use code to get an array of Colbert objects:
$model->colberts
Bu how do I transform this into a DataProvider, I also tried it by creating a DataProvider in the controller, with the following code:
$dataProviderColberts=new CActiveDataProvider('Order', array(
'criteria' => array(
'with' => 'colberts', // relational query name
)
));
Bu that displays all Colbert, not only specific to this Order. The fields the Order and Colbert are linked on are order.id and colbert.orderId!
I’ve already searched for examples and looked through the manual, but I can’t find the solution! I’m sorry if this is an easy answer but you would really help me out!
Thanks in advance!