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

[5.6] syncOriginal on refresh #21905

Merged
merged 1 commit into from
Nov 1, 2017
Merged

[5.6] syncOriginal on refresh #21905

merged 1 commit into from
Nov 1, 2017

Conversation

patrickomeara
Copy link
Contributor

@patrickomeara patrickomeara commented Nov 1, 2017

This is a new PR from #21889 with target version 5.6, instead of 5.5

Currently, after refreshing a model it can be dirty even when the attributes match those in the database.

$post = Post::create(['title' => 'pat']);

Post::find($post->id)->update(['title' => 'patrick']);

$post->refresh();

// current result
$post->getOriginal('title'); // pat
$post->getDirty(); // ['title' => 'patrick']

// with proposed fix 
$post->getOriginal('title'); // patrick
$post->getDirty(); // []

Syncing with the original after refresh prevents this.

@taylorotwell taylorotwell merged commit f1584bf into laravel:master Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants