2016-01-22 97 views

回答

0

「地址」字段是客戶模型與地址模型中的關係。客戶模型包含的關係:

class Customer extends \yii\db\ActiveRecord 
{ 
    .... 
    public function getAddresses() 
    { 
     return $this->hasMany(Address::className(), ['customer_id'=>'id']); 
    } 
} 

記錄在這個小工具

+0

安德魯喜的幫助下,地址模式的轉變數量,感謝您的回覆,我沒有得到任何方法開始GET- - 在我的項目實際上創建方法工作正常,但是當我試圖更新我得到錯誤。我已經添加了代碼和屏幕http://stackoverflow.com/questions/34946322/undefined-variable-yii2?noredirect=1#comment57627368_34946322此鏈接 – Nayank

+0

在該主題已回覆。我希望這有幫助。 –