You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have a little issue:
There are two models: User and UserInfo, relation one-to-one.
User: public function getInfo() { return $this->hasOne(UserInfo::className(), ['user_id' => 'id']); }
Info: public function getUser() { return $this->hasOne(User::className(), ['id' => 'user_id']); }
when I try to post data: { "username": "admin2", "email": "[email protected]", "phone": "+380666818275", "firstname": "Live23", "lastname": "fff23", "country_code": "UA", "role": "status": 10, "info": { "mail_country": "USA", "mail_address1": "Address1", "mail_address2": "Address 2", "mail_city": "City", "mail_state": "State", "mail_zip": "123456", "date_start": null, "date_end": null, "deposit_direct": 1, "text_info": "text info", "text_bullet": "text bullet", "text_short": "text short", "text_readmore": "text readmore", "photo": null, "g_ppm": null, "a_ppm": null } }
I have an error: "name": "Relation exception", "message": "Owner-model admin\\models\\User not saved due to unknown error", "code": 0, "type": "notamedia\\relation\\RelationException", "file": "/home/oles/liveadvisor-api3/vendor/notamedia/yii2-relation/RelationBehavior.php", "line": 317,
But when I update user & userinfo (with user_id field), it's working well.
Can you help?
The text was updated successfully, but these errors were encountered:
Hello, I have a little issue:
There are two models: User and UserInfo, relation one-to-one.
User:
public function getInfo() { return $this->hasOne(UserInfo::className(), ['user_id' => 'id']); }
Info:
public function getUser() { return $this->hasOne(User::className(), ['id' => 'user_id']); }
when I try to post data:
{ "username": "admin2", "email": "[email protected]", "phone": "+380666818275", "firstname": "Live23", "lastname": "fff23", "country_code": "UA", "role": "status": 10, "info": { "mail_country": "USA", "mail_address1": "Address1", "mail_address2": "Address 2", "mail_city": "City", "mail_state": "State", "mail_zip": "123456", "date_start": null, "date_end": null, "deposit_direct": 1, "text_info": "text info", "text_bullet": "text bullet", "text_short": "text short", "text_readmore": "text readmore", "photo": null, "g_ppm": null, "a_ppm": null } }
I have an error:
"name": "Relation exception", "message": "Owner-model admin\\models\\User not saved due to unknown error", "code": 0, "type": "notamedia\\relation\\RelationException", "file": "/home/oles/liveadvisor-api3/vendor/notamedia/yii2-relation/RelationBehavior.php", "line": 317,
But when I update user & userinfo (with user_id field), it's working well.
Can you help?
The text was updated successfully, but these errors were encountered: