mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-782: method get and set don't work for the property datetime with sql server 2008 #962
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Sep 1, 2010).
Jira issue originally created by user minxuan.guo:
after executing ".... convert-mapping --from-database annotation ..." with SQL server 2008, for each column which type is "datetime", doctrine 2 create a property with type="datetime"
this is ok.
BUT, the method *get* and set of these properties ( type="datetime" ) don't work.
the method "get" return 'false'
the method "set" : Fatal error: Call to a member function format() on a non-object in ......\Doctrine\DBAL\Types\DateTimeType.php on line 46
NOTE: if we replace type="datetime"* by *type="string", we can use the data like a string,
@doctrinebot commented on GitHub (Sep 1, 2010):
Comment created by @beberlei:
Can you show me what the exact value of the data looks like when returned from the statement cursor? i.e. for mysql it would be something like "2010-01-04 10:10:10" for postgres its "2010-01-04 10:10:10.00000" and so on.
@doctrinebot commented on GitHub (Sep 1, 2010):
Comment created by minxuan.guo:
when I "select dateXXXX from xxxx", I'll get something like
1987-02-17 00:00:00.000
@doctrinebot commented on GitHub (Sep 1, 2010):
Comment created by @beberlei:
strange, MS SQL Platform defines the default date format as Y-m-d H:i:s.u
@doctrinebot commented on GitHub (Sep 2, 2010):
Comment created by minxuan.guo:
Y-m-d H:i:s.{color:red}u{color}
ok, and is there any document talk about the {color:red}u{color},
I find only this
http://msdn.microsoft.com/en-us/library/ms187819.aspx
time 12:35:29. 1234567
date 2007-05-08
smalldatetime 2007-05-08 12:35:00
datetime {color:red}2007-05-08 12:35:29.123{color}
datetime2 2007-05-08 12:35:29. 1234567
datetimeoffset 2007-05-08 12:35:29.1234567 +12:15
@doctrinebot commented on GitHub (Sep 2, 2010):
Comment created by the_angry_angel:
Sorry for butting in, but this had me the other day.
Minxuan if you check out line 392 of Doctrine/DBAL/Platform/MsSqlPlatform.php you'll notice that Doctrine expects DATETIME2(6) to be used for datetime fields in the database :)
When you run the convert mapping it doesn't currently check and throw a warning if you're just using DATETIME :)
@doctrinebot commented on GitHub (Dec 28, 2010):
Comment created by @beberlei:
This should be fixed already.
@doctrinebot commented on GitHub (Dec 28, 2010):
Issue was closed with resolution "Fixed"