I’m absolutely new to yii so, please forgive my ignorance…
I have a test assignment to create a user list. I have a “anagrafica” table (people) and a “documenti” (different kinds of documents) . the db is set to link the “tipodocumento” (document type) of “anagrafica” table to the “id” field of the “documenti” table. I managed to create a dropdown lint in the _form.php file using a tutorial, so i suppose db tables are correctly linked. I simply want to display the “tipologia” field of the “documenti” table, but i apparently continue to get errors.
in the “anagrafica” controller i wrote this:
public function getNomedocumento()
{
return $this->hasOne(Documenti::className(), ['id' => 'tipologia']);
}
while in the view.php file for the anagrafica i have this
<?= DetailView::widget([ 'model' => $model, 'attributes' => [ 'id', 'nome', 'cognome', 'eta', 'email:email', ['attribute'=>'tipodocumento','value'=>$model->nomedocumento->tipologia], ], ]) ?>I’m currently getting this error message