Unverified Commit 258f88ad authored by alexpott's avatar alexpott

Issue #2799911 by GoZ, sokru, daffie, catch: Make the Connection parameter the...

Issue #2799911 by GoZ, sokru, daffie, catch: Make the Connection parameter the first parameter in Select Query Builder
parent d1daa7ec
......@@ -806,7 +806,7 @@ public function getDriverClass($class) {
*/
public function select($table, $alias = NULL, array $options = []) {
$class = $this->getDriverClass('Select');
return new $class($table, $alias, $this, $options);
return new $class($this, $table, $alias, $options);
}
/**
......
......@@ -121,16 +121,16 @@ class Select extends Query implements SelectInterface {
/**
* Constructs a Select object.
*
* @param \Drupal\Core\Database\Connection $connection
* Database connection object.
* @param string $table
* The name of the table that is being queried.
* @param string $alias
* The alias for the table.
* @param \Drupal\Core\Database\Connection $connection
* Database connection object.
* @param array $options
* Array of query options.
*/
public function __construct($table, $alias, Connection $connection, $options = []) {
public function __construct(Connection $connection, $table, $alias = NULL, $options = []) {
$options['return'] = Database::RETURN_STATEMENT;
parent::__construct($connection, $options);
$conjunction = isset($options['conjunction']) ? $options['conjunction'] : 'AND';
......
......@@ -26,7 +26,7 @@ protected function setUp() {
$connection = $this->getMockBuilder('Drupal\Core\Database\Connection')
->disableOriginalConstructor()
->getMockForAbstractClass();
$this->query = new Select('test', NULL, $connection);
$this->query = new Select($connection, 'test', NULL);
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment