relationships without any widget.

good morning, I am in a dilemma yii2 relations.

in version 1.1 relations were most basic, I think the relationship in the model need only pull the information and added the name of the relation and a point by referring the field name of the table.

but now, in the version yii2 eh created a function with the relationship as indicated by the manual

"GetIdPersona public function ()

{


    return $ this-> hasOne (Person :: className () ['npersonaid' => 'nformacionpersona']);


} "

but to pull it follows

"$ Model-> getIdPersona-> npersonaname"

tells me the following error,

"Unknown Property - yii \ base \ UnknownPropertyException

Getting unknown property: app \ models \ Training :: getIdPersona "

any help?

attached my model and view




<? Php


namespace app \ models;


Yii use;


/ **

 * This is the model class for table "training".

 *

 *property Integer $ nformacionid

 *property Integer $ nformacionpersona

 *property String $ nformacionnivel

 *property String $ I cformaciongrado

 *property String $ cformacioncarrrera

 *property String $ cformacioninstitucion

 *property String $ dformacioninicio

 *property String $ dformacionfin

 *property String $ cformaciondescripcion

 *

 *property Person $ nformacionpersona0

 * /

Training class extends \ yii \ db \ ActiveRecord

{

    / **

     *inheritdoc

     * /

    public static function tableName ()

    {

        return 'training';

    }


    / **

     *inheritdoc

     * /

    public function rules ()

    {

        return [

            [['Nformacionnivel', 'nformacionpersona'], 'integer'],

            [['Cformaciongrado', 'cformacioncarrrera'], 'required'],

            [['Dformacioninicio', 'dformacionfin'], 'safe'],

            [['Cformaciongrado'], 'string', 'max' => 1],

            [['Cformacioncarrrera'], 'string', 'max' => 500]

            [['Cformacioninstitucion', 'cformaciondescripcion'], 'string', 'max' => 450]

        ];

    }


    / **

     *inheritdoc

     * /

    attributeLabels public function ()

    {

        return [

            'Nformacionid' => 'Nformacionid'

            'Nformacionpersona' => 'Nformacionpersona'

            'Nformacionnivel' => 'Nformacionnivel'

            'Cformaciongrado' => 'Cformaciongrado'

            'Cformacioncarrrera' => 'Cformacioncarrrera'

            'Cformacioninstitucion' => 'Cformacioninstitucion'

            'Dformacioninicio' => 'Dformacioninicio'

            'Dformacionfin' => 'Dformacionfin'

            'Cformaciondescripcion' => 'Cformaciondescripcion'

        ];

    }


    / **

     *return \ Yii \ db \ ActiveQuery

     * /

    getIdPersona public function ()

    {

        return $ this-> hasOne (Person :: className () ['npersonaid' => 'nformacionpersona']);

    }

}






<? Php


use yii \ helpers \ Html;

use yii \ widgets \ DetailView;


/ *var $ This yii \ web \ View * /

/ *var $ Model app \ models \ Training * /


$ This-> title = $ model-> nformacionid;

$ This-> params ['breadcrumbs'] [] = ['label' => 'Training Center', 'url' => ['index']];

$ This-> params ['breadcrumbs'] [] = $ this-> title;

?>

<Div class = "training-view">

    <Div class = "col-sm-12">

        <Div class = "row boxer">

            <Div class = "description col-sm-6 col-xs-7">

                <Span class = "clwhite"> <b> <? = $ Model-> cformacioninstitucion?> </ B> </ span> <br>

                <Span class = "clwhite"> <? = $ Model-> nformacionnivel. ' -. '$ Model-> cformaciongrado> </ span> <br>?

                <Span class = "clwhite"> <? = $ Model-> cformacioncarrrera?> </ Span> <br>

                <Span class = "clwhite"> start: <strong> <? = $ Model-> dformacioninicio> </ strong> End: <strong> <= $ model-> dformacionfin> </ strong> </ span>? <br/>

                <Span class = "clwhite"> <? = $ Model-> getIdPersona-> npersonaid?> </ Span> <br>

            </ Div>

            <Div class = "col-xs-4 option col-sm-2" id = "choice" style = "display: none;">

                <Div class = "boxupdate al-sm-1"> <? = HTML :: a ('<span class = "glyphicon glyphicon-pencil clwhite" aria-hidden = "true"> </ span>', ['update ',' id '=> $ model-> nformacionid], [' class' => 'btn btn-xs'])?> </ div>

                <Div class = "boxupdate al-sm-1"> <? = HTML :: a ('<span class = "glyphicon glyphicon-remove clwhite" aria-hidden = "true"> </ span>', ['delete ',' id '=> $ model-> nformacionid], [

                        'Class' => 'btn btn-xs'

                        'Data' => [

                            'Confirm' => 'You want to delete the following registry?'

                            'Method' => 'post',

                        ]

                    ])?>

                </ Div>

                <Div class = "boxdelete al-sm-1"> <a href="#" class="btn btn-xs"> </a> </ div>

            </ Div>

        </ Div>

    </ Div>

</ Div>