lithium\data\source\Database::__construct()

public method

Constructor.

Parameters

  • $config array

    Available configuration options are:

    • 'database' string: Name of the database to use. Defaults to null.
    • 'host' string: Name/address of server to connect to. Defaults to 'localhost'.
    • 'login' string: Username to use when connecting to server. Defaults to 'root'.
    • 'password' string: Password to use when connecting to server. Defaults to ''.
    • 'persistent' boolean: If true a persistent connection will be attempted, provided the adapter supports it. Defaults to true.
    • 'options' array: An array with additional PDO options. Maps (driver specific) PDO attribute constants to values.

Returns

void

Source

	public function __construct(array $config = []) {
		$defaults = [
			'persistent' => true,
			'host'       => 'localhost',
			'login'      => 'root',
			'password'   => '',
			'database'   => null,
			'encoding'   => null,
			'dsn'        => null,
			'options'    => []
		];
		parent::__construct($config + $defaults);
	}