1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-25 15:01:29 +02:00

- DibiFluent implements Countable, IteratorAggregate

- DibiDataSource is deprecated
- DibiTranslator - fixed DateTime class support
This commit is contained in:
David Grudl
2009-02-05 01:26:08 +00:00
parent a5a1da19a7
commit bf6dc1cbd1
8 changed files with 136 additions and 74 deletions

View File

@@ -296,9 +296,11 @@ final class DibiTranslator extends DibiObject
if ($value instanceof IDibiVariable) {
return $value->toSql($this, $modifier);
}
if (!is_scalar($value)) { // array is already processed
} elseif ($value instanceof DateTime) {
$value = $value->format('U');
} elseif (!is_scalar($value)) { // array is already processed
$this->hasError = TRUE;
return '**Unexpected type ' . gettype($value) . '**';
}
@@ -329,7 +331,7 @@ final class DibiTranslator extends DibiObject
case 'd': // date
case 't': // datetime
$value = is_numeric($value) ? (int) $value : ($value instanceof DateTime ? $value->format('U') : strtotime($value));
$value = is_numeric($value) ? (int) $value : strtotime($value);
return $this->driver->escape($value, $modifier);
case 'by':
@@ -355,6 +357,7 @@ final class DibiTranslator extends DibiObject
case 'a':
case 'l':
case 'v':
case 'by':
$this->hasError = TRUE;
return '**Unexpected type ' . gettype($value) . '**';