lithium\data\source\database\adapter\PostgreSql::_formatters PHP Method

_formatters() protected method

Provide an associative array of Closures to be used as the "formatter" key inside of the Database::$_columns specification.
See also: lithium\data\source\Database::_formatters()
protected _formatters ( )
    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();
    }