setJoinValue example

$configuration = [
      'left_table' => 'views_test_data',
      'left_field' => 'uid',
      'table' => 'users_field_data',
      'field' => 'uid',
    ];
    $join = $this->manager->createInstance('join_test', $configuration);
    $this->assertInstanceOf(JoinTestPlugin::class$join);

    $rand_int = rand(0, 1000);
    $join->setJoinValue($rand_int);

    $query = Database::getConnection()->select('views_test_data');
    $table = ['alias' => 'users_field_data'];
    $join->buildJoin($query$table$view->query);

    $tables = $query->getTables();
    $join_info = $tables['users_field_data'];
    $this->assertStringContainsString("views_test_data.uid = $rand_int", $join_info['condition'], 'Make sure that the custom join plugin can extend the join base and alter the result.');
  }

  /** * Tests the join plugin base. */
Home | Imprint | This part of the site doesn't use cookies.