Following code will give me back an array of all foreignKeys,which are in table:
public static function fk_for_adresses() {
$auswahl = Ekontakt::find()->select('id_person')->all();
return yii\helpers\ArrayHelper::map($auswahl, 'id_person', 'id_person');
}
Following code will give back all values of table Person,where Primarykey(id)=ForeignKey(id_person), instead only one for each display line(see attachement). Any ideas,what I do wrong?
[
'attribute' => $wird_dargestellt_fuer,
'label' => Yii::t('app', 'gehört zu'),
'format' => 'html',
'value' => function($model) {
$namen = "";
$eKontakte = Ekontakt::fk_for_adresses();
$model = Person::find()->where(['id' => $eKontakte])->all();
foreach ($model as $Kontakt) {
$namen .= "<div id=''><ul><li><span class='glyphicon glyphicon-earphone'></span>" . $Kontakt->vorname . "," . $Kontakt->nachname;
}
$namen .= "</div></ul></li>";
return $namen;
}
],
.
.