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

sources() public method

Returns the list of tables in the currently-connected database.
public sources ( string $model = null ) : array
$model string The fully-name-spaced class name of the model object making the request.
return array Returns an array of sources to which models can connect.
    public function sources($model = null)
    {
        $_config = $this->_config;
        $params = compact('model');
        return $this->_filter(__METHOD__, $params, function ($self, $params) use($_config) {
            $schema = $self->connection->quote($_config['schema']);
            $sql = "SELECT table_name as name FROM INFORMATION_SCHEMA.tables";
            $sql .= " WHERE table_schema = {$schema}";
            if (!($result = $self->invokeMethod('_execute', array($sql)))) {
                return null;
            }
            $sources = array();
            foreach ($result as $row) {
                $sources[] = $row[0];
            }
            return $sources;
        });
    }