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?