function CastedIntFieldJoinTestBase::buildJoin

Same name and namespace in other branches
  1. 10 core/modules/views/tests/src/Kernel/Plugin/CastedIntFieldJoinTestBase.php \Drupal\Tests\views\Kernel\Plugin\CastedIntFieldJoinTestBase::buildJoin()

Builds a join using the given configuration.

Parameters

\Drupal\views\ViewExecutable $view: The view used in this test.

$configuration: The join plugin configuration.

$table_alias: The table alias to use for the join.

Return value

array The join information for the joined table. See \Drupal\Core\Database\Query\Select::$tables for more information on the structure of the array.

1 call to CastedIntFieldJoinTestBase::buildJoin()
CastedIntFieldJoinTestBase::testBuildJoin in core/modules/views/tests/src/Kernel/Plugin/CastedIntFieldJoinTestBase.php
Tests base join functionality.

File

core/modules/views/tests/src/Kernel/Plugin/CastedIntFieldJoinTestBase.php, line 193

Class

CastedIntFieldJoinTestBase
Tests the "casted_int_field_join" join plugin.

Namespace

Drupal\Tests\views\Kernel\Plugin

Code

protected function buildJoin(ViewExecutable $view, $configuration, $table_alias) {
    // Build the actual join values and read them back from the query object.
    $query = \Drupal::database()->select('node');
    $join = $this->manager
        ->createInstance($this->pluginId, $configuration);
    $this->assertInstanceOf(CastedIntFieldJoin::class, $join);
    $table = [
        'alias' => $table_alias,
    ];
    $join->buildJoin($query, $table, $view->query);
    $tables = $query->getTables();
    $join_info = $tables[$table['alias']];
    return $join_info;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.