PHP Class N98\Magento\DbSettings

Database settings. The Magento database settings are stored in a SimpleXMLElement structure
Inheritance: implements ArrayAcces\ArrayAccess, implements IteratorAggregat\IteratorAggregate
Show file Open project: netz98/n98-magerun Class Usage Examples

Public Methods

Method Description
__construct ( string $file )
getConfig ( ) : array content of previous $dbSettings field of the DatabaseHelper
getConnection ( ) : PDO Connects to the database without initializing magento
getDatabaseName ( ) : string
getDsn ( ) : string Get Mysql PDO DSN
getHost ( ) : string
getIterator ( ) : ArrayIterator
getMysqlClientToolConnectionString ( )
getPassword ( ) : string
getPort ( ) : string
getTablePrefix ( ) : string
getUnixSocket ( ) : string
getUsername ( ) : string
isSocketConnect ( ) : boolean
offsetExists ( $offset ) : boolean
offsetGet ( $offset ) : mixed
offsetSet ( mixed $offset, mixed $value )
offsetUnset ( mixed $offset )
setFile ( string $file )

Private Methods

Method Description
parseResources ( SimpleXMLElement $resources ) helper method to parse config file segment related to the database settings
quoteIdentifier ( string $identifier ) : string Mysql quoting of an identifier

Method Details

__construct() public method

public __construct ( string $file )
$file string path to app/etc/local.xml

getConfig() public method

content of previous $dbSettings field of the DatabaseHelper
public getConfig ( ) : array
return array

getConnection() public method

Connects to the database without initializing magento
public getConnection ( ) : PDO
return PDO

getDatabaseName() public method

public getDatabaseName ( ) : string
return string of the database identifier, null if not in use

getDsn() public method

Get Mysql PDO DSN
public getDsn ( ) : string
return string

getHost() public method

public getHost ( ) : string
return string hostname, null if there is no hostname setup (e.g. unix_socket)

getIterator() public method

getMysqlClientToolConnectionString() public method

getPassword() public method

public getPassword ( ) : string
return string password

getPort() public method

public getPort ( ) : string
return string port, null if not setup

getTablePrefix() public method

public getTablePrefix ( ) : string
return string table prefix, null if not in the settings (no or empty prefix)

getUnixSocket() public method

public getUnixSocket ( ) : string
return string unix socket, null if not in use

getUsername() public method

public getUsername ( ) : string
return string username

isSocketConnect() public method

public isSocketConnect ( ) : boolean
return boolean

offsetExists() public method

public offsetExists ( $offset ) : boolean
return boolean true on success or false on failure.

offsetGet() public method

public offsetGet ( $offset ) : mixed
return mixed Can return all value types.

offsetSet() public method

public offsetSet ( mixed $offset, mixed $value )
$offset mixed
$value mixed

offsetUnset() public method

public offsetUnset ( mixed $offset )
$offset mixed

setFile() public method

public setFile ( string $file )
$file string path to app/etc/local.xml