Hello, I use in form.php in the \kartik\widgets\Select2:
'data' => \yii\helpers\ArrayHelper::map(\models\Person::find()->select(['CONCAT(forname, " ", surname) AS name','person.id'])->innerJoinWith('employee')->orderBy('person.id')->asArray()->all(), 'id', 'name')
it does work proper, but i was said to find some other representation, due to MVC strategy, so i have to substitute it. I have to have something else better in model and not in form.
I am looking for substittutes of functions innerJoinWith(), and select([concat…
it is a fk field in employee for person.id
Thanks in advance.