Warum mein relational 'Versuch, Eigenschaft von Nicht-Objekt' ??? id, propinsi_id, nāmaVersuch, Eigenschaft von Nicht-Objekt in retional Yii2 zu bekommen
public function attributeLabels()
{
return [
'id' => 'ID',
'propinsi_id' => 'Propinsi ID',
'nama' => 'Nama',
];
}
In Regler (:
I Modell Destination mit hasOne haben() AddressDistrict
public function getDestinationAddressDistrict(){
return $this->hasOne(\common\models\AddressDistrict::className(), ['id' => 'DISTRICT']);
}
In Modell AdressDistrict alle Felder zu modellieren actionIndex) Ich bekomme Modell Destination:
$modelDestination = new Destination;
und ich gehe zu erstellen dann gehe ich zu _form ..
In _form Ich schreibe $modelDestination->destinationAddressDistrict->id
..und ich habe das mitteilen .. Jede Lösung?
in erstellen haben Sie keinen gültigen Wert für die Beziehung .. – scaisEdge