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

[7.x] Prevent usage of get*AtColumn() when model has no timestamps #33634

Merged
merged 3 commits into from
Jul 24, 2020
Merged

[7.x] Prevent usage of get*AtColumn() when model has no timestamps #33634

merged 3 commits into from
Jul 24, 2020

Conversation

cedric-anne
Copy link
Contributor

@cedric-anne cedric-anne commented Jul 24, 2020

Althought it is uncommon, people may want to be able to reuse Eloquent\Concern traits to build their own model implementation. In my case, I used them to build models objects from multiple sources (XML mainly), and I did not want to use the HasTimestamps trait.
With the proposed modification, using the HasAttributes standalone will not require anymore to define getCreatedAtColumn() and getUpdatedAtColumn(), if usesTimestamps() returns false.

I do not know if I should add a test for this as existing usages inside framework are already tested. I can produce a test for the specific usage I mentionned if you ask me.

@cedric-anne cedric-anne marked this pull request as ready for review July 24, 2020 07:50
@GrahamCampbell GrahamCampbell changed the title Prevent usage of get*AtColumn() when model has no timestamps [7.x] Prevent usage of get*AtColumn() when model has no timestamps Jul 24, 2020
@taylorotwell taylorotwell merged commit 474cdd8 into laravel:7.x Jul 24, 2020
@cedric-anne cedric-anne deleted the models-without-timestamps branch July 24, 2020 13:12
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