mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 21:58:10 +02:00
DibiResult: default type for datetime changed from timestamp -> object DateTime (BC break)
This commit is contained in:
@@ -49,7 +49,7 @@ class DibiResult extends DibiObject implements IDataSource
|
|||||||
private $rowClass = 'DibiRow';
|
private $rowClass = 'DibiRow';
|
||||||
|
|
||||||
/** @var string date-time format */
|
/** @var string date-time format */
|
||||||
private $dateFormat = 'U';
|
private $dateFormat = '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -573,13 +573,13 @@ class DibiResult extends DibiObject implements IDataSource
|
|||||||
if ((int) $value === 0) { // '', NULL, FALSE, '0000-00-00', ...
|
if ((int) $value === 0) { // '', NULL, FALSE, '0000-00-00', ...
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
} elseif ($this->dateFormat === 'U') { // return timestamp (default)
|
} elseif ($this->dateFormat === '') { // return DateTime object (default)
|
||||||
return is_numeric($value) ? (int) $value : strtotime($value);
|
|
||||||
|
|
||||||
} elseif ($this->dateFormat === '') { // return DateTime object
|
|
||||||
return new DateTime53(is_numeric($value) ? date('Y-m-d H:i:s', $value) : $value);
|
return new DateTime53(is_numeric($value) ? date('Y-m-d H:i:s', $value) : $value);
|
||||||
|
|
||||||
} elseif (is_numeric($value)) { // single timestamp
|
} elseif ($this->dateFormat === 'U') { // return timestamp
|
||||||
|
return is_numeric($value) ? (int) $value : strtotime($value);
|
||||||
|
|
||||||
|
} elseif (is_numeric($value)) { // formatted date
|
||||||
return date($this->dateFormat, $value);
|
return date($this->dateFormat, $value);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user