mirror of
https://github.com/dg/dibi.git
synced 2025-08-06 06:07:39 +02:00
DibiTranslator: fixed bug in DateTime object usage
This commit is contained in:
@@ -329,10 +329,7 @@ final class DibiTranslator extends DibiObject
|
|||||||
if ($value instanceof IDibiVariable) {
|
if ($value instanceof IDibiVariable) {
|
||||||
return $value->toSql($this, $modifier);
|
return $value->toSql($this, $modifier);
|
||||||
|
|
||||||
} elseif ($value instanceof DateTime) {
|
} elseif ($value !== NULL && !is_scalar($value) && !($value instanceof DateTime)) { // array is already processed
|
||||||
$value = $value->format('U');
|
|
||||||
|
|
||||||
} elseif ($value !== NULL && !is_scalar($value)) { // array is already processed
|
|
||||||
$this->hasError = TRUE;
|
$this->hasError = TRUE;
|
||||||
return '**Unexpected type ' . gettype($value) . '**';
|
return '**Unexpected type ' . gettype($value) . '**';
|
||||||
}
|
}
|
||||||
@@ -436,7 +433,7 @@ final class DibiTranslator extends DibiObject
|
|||||||
return $value->toSql($this, NULL);
|
return $value->toSql($this, NULL);
|
||||||
|
|
||||||
if ($value instanceof DateTime)
|
if ($value instanceof DateTime)
|
||||||
return $value = $value->format('U');
|
return $this->driver->escape($value, dibi::DATETIME);
|
||||||
|
|
||||||
$this->hasError = TRUE;
|
$this->hasError = TRUE;
|
||||||
return '**Unexpected ' . gettype($value) . '**';
|
return '**Unexpected ' . gettype($value) . '**';
|
||||||
|
Reference in New Issue
Block a user