This seems straight forward but I cannot get it to work.
I have a table, customer_products, with a relation to another table, base_products. I believe I should be able to return the base product name by calling base_products.product_name to display in GridView instead of the id number, customer_product_base_productID.
Relation in Model
public function getCustomerProductBaseProduct()
{
return $this->hasOne(BaseProducts::className(), ['id' => 'customer_product_base_productID']);
}
GridView Widget
[
attribute'=>'base_products.product_name',
'label'=>'Base Product',
],
Error
Getting unknown property: app\models\CustomerProducts::base_products
What am I missing?