public __construct ( array $params, Doctrine\DBAL\Driver $driver, Doctrine\DBAL\Configuration $config = null, Doctrine\Common\EventManager $eventManager = null ) | ||
$params | array | The connection parameters. |
$driver | Doctrine\DBAL\Driver | The driver to use. |
$config | Doctrine\DBAL\Configuration | The configuration, optional. |
$eventManager | Doctrine\Common\EventManager | The event manager, optional. |
public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
{
$this->_driver = $driver;
$this->_params = $params;
if (isset($params['pdo'])) {
$this->_conn = $params['pdo'];
$this->_isConnected = true;
unset($this->_params['pdo']);
}
// Create default config and event manager if none given
if (!$config) {
$config = new Configuration();
}
if (!$eventManager) {
$eventManager = new EventManager();
}
$this->_config = $config;
$this->_eventManager = $eventManager;
$this->_expr = new Query\Expression\ExpressionBuilder($this);
$this->autoCommit = $config->getAutoCommit();
}
/** * * @param array $params * @param \Doctrine\DBAL\Driver $driver * @param \Doctrine\DBAL\Configuration|null $config * @param \Doctrine\Common\EventManager|null $eventManager */ public function __construct(array $params, $driver, $config = null, $eventManager = null) { $this->_platformMock = new DatabasePlatformMock(); parent::__construct($params, $driver, $config, $eventManager); // Override possible assignment of platform to database platform mock $this->_platform = $this->_platformMock; }