lithium\data\source\database\adapter\PostgreSql::_formatters()
Provide an associative array of Closures to be used as the "formatter" key inside of the
Database::$_columns
specification.
Source
protected function _formatters() {
$self = $this;
$datetime = $timestamp = function($format, $value) use ($self) {
if ($format && (($time = strtotime($value)) !== false)) {
$val = date($format, $time);
if (!preg_match('/^' . preg_quote($val) . '\.\d+$/', $value)) {
$value = $val;
}
}
return $self->connection->quote($value);
};
return compact('datetime', 'timestamp') + array(
'boolean' => function($value) use ($self){
return $self->connection->quote($value ? 't' : 'f');
}
) + parent::_formatters();
}