Skizito
(Alexandrepaulino92)
1
Hi I wanted to know if something is possible to do with gridview.
I have a table of Dots, that have a campaign id. The campaign table has a product id and the product table has a prouct_name.
Is it possible to get the product name? I cam get the campaign on the DotSearch by doing
public function getCampaign() {
return $this->hasOne(Campaign::className(), [‘dot_cam_id’ => ‘dot_dots_cam_id’]);
}
And with that I can access the product id on the gridview but not the product name.
dency
(Dencydxp)
2
Similarly write a relationship in your campaign model.Something like,
public function getProduct() {
return $this->hasOne(Product::className(), [‘p_id_in_your_products_table’ => ‘product_id_in_your_campaign_table’]);
}
And access it like,
$data->campaign->product->product_name