mapJoinable example

    $sql_base = new TestSqlBase();
    $sql_base->setMigration($migration);
    $sql_base->setDatabase($source_connection);

    // Configure the idMap to make the check in mapJoinable() pass.     if ($with_id_map) {
      $sql_base->setIds([
        'uid' => ['type' => 'integer', 'alias' => 'u'],
      ]);
    }

    $this->assertEquals($expected_result$sql_base->mapJoinable());
  }

  /** * The data provider for SqlBase. * * @return array * An array of data per test run. */
  public function sqlBaseTestProvider() {
    return [
      // Source ids are empty so mapJoinable() is false.
      // 1. If the map is joinable, join it. We will want to accept all rows       // which are either not in the map, or marked in the map as NEEDS_UPDATE.       // Note that if high water fields are in play, we want to accept all rows       // above the high water mark in addition to those selected by the map       // conditions, so we need to OR them together (but AND with any existing       // conditions in the query). So, ultimately the SQL condition will look       // like (original conditions) AND (map IS NULL OR map needs update       // OR above high water).       $conditions = $this->query->orConditionGroup();
      $condition_added = FALSE;
      $added_fields = [];
      if ($this->mapJoinable()) {
        // Build the join to the map table. Because the source key could have         // multiple fields, we need to build things up.         $count = 1;
        $map_join = '';
        $delimiter = '';
        foreach ($this->getIds() as $field_name => $field_schema) {
          if (isset($field_schema['alias'])) {
            $field_name = $field_schema['alias'] . '.' . $this->query->escapeField($field_name);
          }
          $map_join .= "$delimiter$field_name = map.sourceid" . $count++;
          $delimiter = ' AND ';
        }
Home | Imprint | This part of the site doesn't use cookies.