mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Remove MSSQLDatabase date/datetime workarounds from DataObject::__construct()
These are being handled by the MSSQLDatabase class in the mssql module instead, which keeps the workarounds separated from the framework core.
This commit is contained in:
parent
d95e9a06b3
commit
59e68f16da
@ -322,35 +322,6 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: MSSQL has a convert function that can do this on the SQL end. We just need a
|
|
||||||
// nice way of telling the database how we want to get the value out on a per-fieldtype basis
|
|
||||||
if(DB::getConn() instanceof MSSQLDatabase) {
|
|
||||||
$this->class = get_class($this);
|
|
||||||
foreach($record as $k => $v) {
|
|
||||||
if($v) {
|
|
||||||
if($k == 'Created' || $k == 'LastEdited') {
|
|
||||||
$fieldtype = 'SS_Datetime';
|
|
||||||
} else {
|
|
||||||
$fieldtype = $this->db($k);
|
|
||||||
}
|
|
||||||
|
|
||||||
// MSSQLDatabase::date() uses datetime for the data type for "Date" and "SS_Datetime"
|
|
||||||
switch($fieldtype) {
|
|
||||||
case "Date":
|
|
||||||
$v = preg_replace('/:[0-9][0-9][0-9]([ap]m)$/i', ' \\1', $v);
|
|
||||||
$record[$k] = date('Y-m-d', strtotime($v));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "Datetime":
|
|
||||||
case "SS_Datetime":
|
|
||||||
$v = preg_replace('/:[0-9][0-9][0-9]([ap]m)$/i', ' \\1', $v);
|
|
||||||
$record[$k] = date('Y-m-d H:i:s', strtotime($v));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set $this->record to $record, but ignore NULLs
|
// Set $this->record to $record, but ignore NULLs
|
||||||
$this->record = array();
|
$this->record = array();
|
||||||
foreach($record as $k => $v) {
|
foreach($record as $k => $v) {
|
||||||
|
Loading…
Reference in New Issue
Block a user