Other model data not showing in my Gridview.
I have 2 models,ListForms and Lists. I want to show list name from Lists on listforms gridview. This is my code.
ListForms Model:
class ListForms extends \yii\db\ActiveRecord{
// relation name
public $listname;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'listForms';
}
public function getListname() {
return $this->hasOne(Lists::classname(), ['listid' => 'listids']);
}
ListForms GridView:
[
'label'=>'List Name',
'attribute' => 'listname',
'value' => 'listname.listname'
],
ListFormsSearch:
public function search($params){
$query = ListForms::find();
$query->joinWith(['listname']);
//...
}