You are here

public function MigrateItemsXML::getIdList in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 plugins/sources/xml.inc \MigrateItemsXML::getIdList()

Load ID's from URLs.

Load ids from all urls and map them in idsMap depending on the currentURL.

After ids were fetched from all urls store them in cacheIDs and return the whole list.

Return value

array mapped ID's

Overrides MigrateItems::getIdList

2 calls to MigrateItemsXML::getIdList()
MigrateItemsXML::computeCount in plugins/sources/xml.inc
Return a count of all available IDs from the source listing.
MigrateItemsXML::getItem in plugins/sources/xml.inc
Implementers are expected to return an object representing a source item. Items from currentUrl are cached as an array of key=ID and value=stdClass object with attribute xml containing the xml SimpleXMLElement object of the item.

File

plugins/sources/xml.inc, line 628
Support for migration from XML sources.

Class

MigrateItemsXML
Implementation of MigrateItems, for providing a list of IDs and for retrieving a parsed XML document given an ID from this list.

Code

public function getIdList() {
  $ids = array();
  foreach ($this->urls as $url) {
    migrate_instrument_start("Retrieve {$url}");

    // Make sure, to load new xml.
    $this->currentUrl = $url;
    $xml = $this
      ->xml();
    if ($xml !== FALSE) {
      $url_ids = $this
        ->getIdsFromXML($xml);
      $this->idsMap[$url] = $url_ids;
      $ids = array_merge($ids, $url_ids);
    }
    migrate_instrument_stop("Retrieve {$url}");
  }
  if (!empty($ids)) {
    $this->cacheIDs = array_unique($ids);
    return $this->cacheIDs;
  }
  return NULL;
}