Yii2 model relation not working -


other model data not showing in gridview.

i have 2 models,listforms , lists. want show list name lists on listforms gridview. 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']);                      //...                } 

remove

public $listname;        

from model, because declare variable in model not taken database , shown. not work in lot of places.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -