Skip to content

Commit

Permalink
Due to configuration merging, users were not getting the help excepti…
Browse files Browse the repository at this point in the history
…on for login
  • Loading branch information
lorenzo committed Nov 7, 2014
1 parent c95def9 commit 65fc622
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 7 additions & 0 deletions src/Database/Driver.php
Expand Up @@ -17,6 +17,7 @@
use Cake\Database\Query;
use Cake\Database\QueryCompiler;
use Cake\Database\ValueBinder;
use InvalidArgumentException;

/**
* Represents a database diver containing all specificities for
Expand Down Expand Up @@ -52,8 +53,14 @@ abstract class Driver {
* Constructor
*
* @param array $config The configuration for the driver.
* @throws InvalidArgumentException
*/
public function __construct($config = []) {
if (empty($config['username']) && !empty($config['login'])) {
throw new InvalidArgumentException(
'Please pass "username" instead of "login" for connecting to the database'
);
}
$config += $this->_baseConfig;
$this->_config = $config;
if (!empty($config['quoteIdentifiers'])) {
Expand Down
7 changes: 0 additions & 7 deletions src/Database/Driver/PDODriverTrait.php
Expand Up @@ -15,7 +15,6 @@
namespace Cake\Database\Driver;

use Cake\Database\Statement\PDOStatement;
use InvalidArgumentException;
use PDO;

/**
Expand All @@ -36,14 +35,8 @@ trait PDODriverTrait {
* @param string $dsn A Driver-specific PDO-DSN
* @param array $config configuration to be used for creating connection
* @return bool true on success
* @throws InvalidArgumentException
*/
protected function _connect($dsn, array $config) {
if (empty($config['username']) && !empty($config['login'])) {
throw new InvalidArgumentException(
'Please pass "username" instead of "login" for connecting to the database'
);
}
$connection = new PDO(
$dsn,
$config['username'],
Expand Down

0 comments on commit 65fc622

Please sign in to comment.