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

Fix model with no updated_at or deleted_at columns #104

Merged
merged 1 commit into from
Mar 3, 2024

Conversation

Roxayl
Copy link
Contributor

@Roxayl Roxayl commented Mar 3, 2024

Laravel allows overriding the column name used for timestamps (by default updated_at/deleted_at), or disabling timestamps completely by setting the UPDATED_AT and DELETED_AT constants to null (docs). With strict enough error reporting settings, whenever one of those columns is disabled (e.g. set to null), an ErrorException is thrown:

return ( count(array_diff_key($this->versionableDirtyData, array_flip($removeableKeys))) > 0 );

ErrorException: array_flip(): Can only flip string and integer values, entry skipped

The pull request adds checks to ensure the column names for timestamps is valid/not null.

@nonoesp
Copy link
Collaborator

nonoesp commented Mar 3, 2024

Thanks @Roxayl!

@nonoesp nonoesp merged commit 5b2786d into mpociot:master Mar 3, 2024
@Roxayl Roxayl deleted the bugfix/null-created-updated-fields branch March 3, 2024 22:10
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