Skip to content

Conversation

@golubkovden
Copy link
Contributor

Reopened PR from #18385

add tests

@GrahamCampbell GrahamCampbell changed the title [5.4] add date and cast check for dirty - reopen [5.5] add date and cast check for dirty - reopen Mar 18, 2017
@GrahamCampbell GrahamCampbell changed the title [5.5] add date and cast check for dirty - reopen [5.5] add date and cast check for dirty Mar 19, 2017
@taylorotwell
Copy link
Member

Your tests fail.

@golubkovden
Copy link
Contributor Author

Hm...
Looks like i have same problem with travis as #18417
Will check in local tests.


// When check rich this check and current attribute value not equals with original, we should skip next steps
// if current is null
if (is_null($current)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check for nullable may be should move to fromDateTime method as like castAttribute method.

This hack check looked from setAttribute

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fully agree, either that or should to include the original value in the check too:

 if (is_null($current) || is_null($original)) {
  • is_null($current) covers updating filled column with NULL
  • is_null($original) covers updating NULL with filling

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The missing is_null($original) causes problems for deleted_at which is NULL before a model is updated.

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.

4 participants