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

eloquent dates accept DateTime, and return Carbon objects #1012

Merged
merged 1 commit into from Apr 20, 2013

Conversation

Projects
None yet
3 participants
@kapv89
Contributor

kapv89 commented Apr 19, 2013

In reference to issue #999

@@ -2,6 +2,7 @@
use Closure;
use DateTime;

This comment has been minimized.

@jasonlewis

jasonlewis Apr 19, 2013

Contributor

No need for this then?

@jasonlewis

jasonlewis Apr 19, 2013

Contributor

No need for this then?

This comment has been minimized.

@kapv89

kapv89 Apr 19, 2013

Contributor

nah .. if i just switch to use Carbon\Carbon as DateTime or something (ie, completely replace date-times, then much of existing code would get screwed up. Only overriding the existing Eloquent::asDateTime method allows Eloquent to work with DateTime and any of its child classes, but accessing a date via Eloquent returns a Carbon\Carbon object

@kapv89

kapv89 Apr 19, 2013

Contributor

nah .. if i just switch to use Carbon\Carbon as DateTime or something (ie, completely replace date-times, then much of existing code would get screwed up. Only overriding the existing Eloquent::asDateTime method allows Eloquent to work with DateTime and any of its child classes, but accessing a date via Eloquent returns a Carbon\Carbon object

This comment has been minimized.

@jasonlewis

jasonlewis Apr 19, 2013

Contributor

Ah, no I was under the impression that the DateTime class wasn't being used anywhere else. I didn't actually look. Disregard.

@jasonlewis

jasonlewis Apr 19, 2013

Contributor

Ah, no I was under the impression that the DateTime class wasn't being used anywhere else. I didn't actually look. Disregard.

taylorotwell added a commit that referenced this pull request Apr 20, 2013

Merge pull request #1012 from kapv89/carbon-datetimes
eloquent dates accept DateTime, and return Carbon objects

@taylorotwell taylorotwell merged commit 44bdc38 into laravel:master Apr 20, 2013

1 check failed

default The Travis build could not complete due to an error
Details
@taylorotwell

This comment has been minimized.

Show comment
Hide comment
@taylorotwell
Member

taylorotwell commented Apr 20, 2013

fixes #999

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