Skip to content

Instantly share code, notes, and snippets.

@tlenclos
Created May 11, 2012 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlenclos/2659793 to your computer and use it in GitHub Desktop.
Save tlenclos/2659793 to your computer and use it in GitHub Desktop.
Laravel\Database\Connectors::options(), cannot override the default connection options
<?php namespace Laravel\Database\Connectors; use PDO;
abstract class Connector {
/**
* The PDO connection options.
*
* @var array
*/
protected $options = array(
PDO::ATTR_CASE => PDO::CASE_LOWER,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
PDO::ATTR_STRINGIFY_FETCHES => false,
PDO::ATTR_EMULATE_PREPARES => false,
);
/**
* Establish a PDO database connection.
*
* @param array $config
* @return PDO
*/
abstract public function connect($config);
/**
* Get the PDO connection options for the configuration.
*
* Developer specified options will override the default connection options.
*
* @param array $config
* @return array
*/
protected function options($config)
{
$options = (isset($config['options'])) ? $config['options'] : array();
- return $this->options + $options;
+ return $options + $this->options;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment