You are here

public function DrupalVersion6::getPath in Drupal-to-Drupal data migration 7.2

Given a source path (e.g, 'node/123'), return the first alias for that path.

Parameters

$source:

Return value

string

Overrides DrupalVersion::getPath

File

d6/d6.inc, line 51
Implementation of DrupalVersion for Drupal 6 sources.

Class

DrupalVersion6
Drupal 6 implementations of functions shared among multiple types of objects.

Code

public function getPath($source) {
  migrate_instrument_start('DrupalVersion6::getPath');
  if (Database::getConnection('default', $this->arguments['source_connection'])
    ->schema()
    ->tableExists('url_alias')) {
    $path = Database::getConnection('default', $this->arguments['source_connection'])
      ->select('url_alias', 'ua')
      ->fields('ua', array(
      'dst',
    ))
      ->condition('src', $source)
      ->orderBy('pid', 'DESC')
      ->execute()
      ->fetchField();
  }
  else {
    $path = $source;
  }
  migrate_instrument_stop('DrupalVersion6::getPath');
  return $path;
}