Multiple related columns in dropdown

Need some help with related columns in the dropDownList.

A dropdown with one related column works fine:

In the model "Race":




public static function getRacetrackList(){

    $droptions = Racetrack::find()->asArray()->all();

    return ArrayHelper::map($droptions, 'id', 'trackname');

    }



In the view:




<?= $form->field($model, 'racetrack_id')->dropDownList($model->racetrackList, [ 'prompt' => 'Please Choose One' ]);?>



In order to concat trackname and trackcountry in the dropdown I made a get-function in the model "Racetrack":




public function getFullTrack() {

    return $this->trackname . ' ' . $this->trackcountry;

    }



But I can’t access to it from the “Race” model with:




public static function getRacetrackList(){

    $droptions = Racetrack::find()->asArray()->all();

    return ArrayHelper::map($droptions, 'id', 'fullTrack');

    }



The dropDownList in the view is empty (except for the prompt string).

As being a Newbie I am sure I missed something. Can anyone help please?

I solved this problem by switching over from mysql to mariadb and using a virtual column. Don’t know what version of mysql will support virtual columns, but the one I used a couple of months ago didn’t.

Thanks akorinek.

So there is no chance to access the "getFullTrack" function from the related child model without changing the db?

Other suggestions are still appreciated.