getSourceIdsHash example

// Merge back custom settings.     return $schema + $custom_settings;
  }

  /** * {@inheritdoc} */
  public function getRowBySource(array $source_id_values) {
    $query = $this->getDatabase()->select($this->mapTableName(), 'map')
      ->fields('map');
    $query->condition($this::SOURCE_IDS_HASH, $this->getSourceIdsHash($source_id_values));
    $result = $query->execute();
    return $result->fetchAssoc();
  }

  /** * {@inheritdoc} */
  public function getRowByDestination(array $destination_id_values) {
    $query = $this->getDatabase()->select($this->mapTableName(), 'map')
      ->fields('map');
    foreach ($this->destinationIdFields() as $field_name => $destination_id) {
      

  public function testSaveIdMapping() {
    $source = [
      'source_id_property' => 'source_value',
    ];
    $row = new Row($source['source_id_property' => []]);
    $id_map = $this->getIdMap();
    $id_map->saveIdMapping($row['destination_id_property' => 2]);
    $expected_result = [
      [
        'sourceid1' => 'source_value',
        'source_ids_hash' => $this->getIdMap()->getSourceIdsHash($source),
        'destid1' => 2,
      ] + $this->idMapDefaults(),
    ];
    $this->queryResultTest($this->getIdMapContents()$expected_result);
    $source = [
      'source_id_property' => 'source_value_1',
    ];
    $row = new Row($source['source_id_property' => []]);
    $id_map->saveIdMapping($row['destination_id_property' => 3]);
    $expected_result[] = [
      'sourceid1' => 'source_value_1',
      
->fields([
        'title' => $title,
        'format' => 2,
      ])
      ->condition('vid', 3)
      ->execute();
    $migration = $this->getMigration('d6_node:story');
    $table_name = $migration->getIdMap()->mapTableName();
    $default_connection = \Drupal::database();
    $default_connection->truncate($table_name)->execute();
    if ($new_row) {
      $hash = $migration->getIdMap()->getSourceIdsHash(['nid' => $new_row['sourceid1']]);
      $new_row['source_ids_hash'] = $hash;
      $default_connection->insert($table_name)
        ->fields($new_row)
        ->execute();
    }
    $this->executeMigration($migration);
    return $title;
  }

}
Home | Imprint | This part of the site doesn't use cookies.