php-rql icon indicating copy to clipboard operation
php-rql copied to clipboard

Idea: accept \DateTime on insertion

Open thijsw opened this issue 9 years ago • 1 comments

Hi,

First and foremost, thanks for making this client :)

As a suggestion, I would propose an idea that will make the insertion of dates to the database a bit easer (at least for me).

I'd like to be able to save \DateTime instances such that the dates are stored in the native manner, just like with \r\now(), handle by the client. Another option to make this easier would be to include a static method in r\Queries\Dates\Time, e.g. fromDateTime that accepts a \DateTime and yields a new Time object, that can be used for insertion.

Maybe this is already possible and I am missing something, but I couldn't find any information about in the docs.

Any ideas?

thijsw avatar Dec 23 '15 15:12 thijsw

Hi @thijsw . Sorry for my late response. This should already be working. It's just not documented right now.

If you run r\expr(new \DateTime(...))->run($conn) you should get another \DateTime object back, despite it being sent to the server first.

Let me know if there are any issues.

danielmewes avatar Feb 03 '16 00:02 danielmewes