Unverified Commit 258f88ad authored by Alex Pott's avatar Alex Pott
Browse files

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
Loading
Loading
Loading
Loading
+1 −1
Changes for core/lib/Drupal/Core/Database/Connection.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -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);
  }

  /**
+3 −3
Changes for core/lib/Drupal/Core/Database/Query/Select.php: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -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';
+1 −1
Changes for core/tests/Drupal/Tests/Core/Database/OrderByTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -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);
  }

  /**