getQualifiedMapTableName example

$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 ';
        }

        $alias = $this->query->leftJoin($this->migration->getIdMap()
          ->getQualifiedMapTableName(), 'map', $map_join);
        $conditions->isNull($alias . '.sourceid1');
        $conditions->condition($alias . '.source_row_status', MigrateIdMapInterface::STATUS_NEEDS_UPDATE);
        $condition_added = TRUE;

        // And as long as we have the map table, add its data to the row.         $n = count($this->getIds());
        for ($count = 1; $count <= $n$count++) {
          $map_key = 'sourceid' . $count;
          $this->query->addField($alias$map_key, "migrate_map_$map_key");
          $added_fields[] = "$alias.$map_key";
        }
        
/** * Tests the getQualifiedMapTable method with a prefixed database. */
  public function testGetQualifiedMapTablePrefix() {
    $connection_options = [
      'database' => ':memory:',
      'prefix' => 'prefix',
    ];
    $pdo = Connection::open($connection_options);
    $this->database = new Connection($pdo$connection_options);
    $qualified_map_table = $this->getIdMap()->getQualifiedMapTableName();
    // The SQLite driver is a special flower. It will prefix tables with     // PREFIX.TABLE, instead of the standard PREFIXTABLE.     // @see \Drupal\sqlite\Driver\Database\sqlite\Connection::__construct()     $this->assertEquals('prefix.migrate_map_sql_idmap_test', $qualified_map_table);
  }

  /** * Tests all the iterator methods in one swing. * * The iterator methods are: * - Sql::rewind() * - Sql::next() * - Sql::valid() * - Sql::key() * - Sql::current() */
Home | Imprint | This part of the site doesn't use cookies.