Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit 59e68f16da34d48aa240063223fc58d2edfd2d34 1 parent d95e9a0
@halkyon halkyon authored
Showing with 0 additions and 29 deletions.
  1. +0 −29 model/DataObject.php
View
29 model/DataObject.php
@@ -321,35 +321,6 @@ function __construct($record = null, $isSingleton = false, $model = null) {
if($this->db($k) == 'Boolean' && $v == 'f') $record[$k] = '0';
}
}
-
- // 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
$this->record = array();
Please sign in to comment.
Something went wrong with that request. Please try again.