Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When Model after Save, The Relation can not update #4343

Closed
lnmput opened this issue May 22, 2019 · 5 comments
Closed

When Model after Save, The Relation can not update #4343

lnmput opened this issue May 22, 2019 · 5 comments

Comments

@lnmput
Copy link

lnmput commented May 22, 2019

  • OctoberCMS Build: 454
  • PHP Version: 7.2
  • Database Engine: mysql 5.7
  • Plugins Installed: rainlab.user

Description:

In my order nodel
public $belongsTo = [ 'status' => ['Jshop\Order\Models\Status', 'key' => 'status_id'] ];
When I update status_id from 1 to 2 from backend form, I try get $this->status in afterSave() method, But the print data is before value, not change.

@LukeTowers
Copy link
Contributor

@lnmput what about the value of $this->status_id?

@lnmput
Copy link
Author

lnmput commented May 23, 2019

$this->status_id value is update, But $this->status in not

@LukeTowers
Copy link
Contributor

@lnmput call $this->load('status'); first to force the relationship to reload: https://stackoverflow.com/a/23364277/6652884

@lnmput
Copy link
Author

lnmput commented May 24, 2019

Isn't this a new bug? OctoberCMS Build: 419 is ok, but 454 is error。

@LukeTowers
Copy link
Contributor

Possibly, please provide detailed replication instructions using the test plugin and a description of the behaviour in 419 vs 455 and we can look into it further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants