lithium\data\source\database\adapter\PostgreSql::_init()
Overrides
lithium\core\ObjectDeprecated::_init()
Initializer. Constructs a DSN from configuration.
Returns
voidSource
protected function _init() {
if (!$this->_config['host'] && $this->_config['host'] !== false) {
throw new ConfigException('No host configured.');
}
if ($this->_config['host'] === false) {
$this->_config['dsn'] = sprintf(
'pgsql:dbname=%s',
$this->_config['database']
);
} else {
$host = HostString::parse($this->_config['host']) + [
'host' => static::DEFAULT_HOST,
'port' => static::DEFAULT_PORT
];
$this->_config['dsn'] = sprintf(
'pgsql:host=%s;port=%s;dbname=%s',
$host['host'],
$host['port'],
$this->_config['database']
);
}
parent::_init();
}