In my project one of the model named types having multiple relation to other models the criteria with part is giving below its like
$criteria->with = array(
'category',
'subCategory',
'accountsSupplierPriceDetails' => array(
'with' => 'serviceLevel'
)
);
the relationship goes like
- types – category – relation(1-1)
- types – subcategory – relation(1-1)
- types – accountsSupplierPriceDetails – relation(1-1)
- accountsSupplierPriceDetails – serviceLevel – relation(1-n)
my problem is how to display the names from each table in a grid. the result of (1-n) should be displayed in a dropdownbox. when i try to access the data from column it shows the error Trying to get property of non-object ($data->accountsSupplierPriceDetails->serviceLevel ->name). can anyone please help me.
Thanks in advance.
in my view i create a cgridview with 5 rows in which one row data is populated using dropdownlist.
the relation in model is:
the row is
and i use a function to create dropdown data is
please comment if you have any doubt. i am free to share… have a nice day SO friends… wishes and prayers.