You are here

class MigrateSourceEntityReference in Relation 7

Same name and namespace in other branches
  1. 8.2 relation_migrate/relation_migrate.source.inc \MigrateSourceEntityReference
  2. 8 relation_migrate/relation_migrate.source.inc \MigrateSourceEntityReference

Source migration plugin for entityreference.

Hierarchy

Expanded class hierarchy of MigrateSourceEntityReference

File

relation_migrate/relation_migrate.source.inc, line 128
Source plugin for *reference fields.

View source
class MigrateSourceEntityReference extends MigrateSourceReference {

  /**
   * Constructor.
   *
   * @param array $fields List of fields to be migrated.
   */
  function __construct(array $fields, array $options = array()) {
    parent::__construct('entityreference', $fields, $options);
  }

  /**
   * Fetch the next row of data, returning it as an object. Return FALSE
   * when there is no more data available.
   */
  public function getNextRow() {
    if (!empty($this->result[$this->next_row])) {
      $item = $this->result[$this->next_row];
      $dest_type = field_info_field($item->field_name);
      $this->next_row++;
      return $this
        ->_constructRow($item, $dest_type['settings']['target_type'], $item->field_name);
    }
    return FALSE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MigrateSource::$activeMap protected property The MigrateMap class for the current migration.
MigrateSource::$activeMigration protected property The Migration class currently invoking us, during rewind() and next().
MigrateSource::$cacheCounts protected property Whether this instance should cache the source count.
MigrateSource::$cacheKey protected property Key to use for caching counts.
MigrateSource::$currentKey protected property The primary key of the current row
MigrateSource::$currentRow protected property The current row from the quey
MigrateSource::$highwaterField protected property Information on the highwater mark for the current migration, if any.
MigrateSource::$idList protected property List of source IDs to process.
MigrateSource::$mapRowAdded protected property By default, next() will directly read the map row and add it to the data row. A source plugin implementation may do this itself (in particular, the SQL source can incorporate the map table into the query) - if so, it should set this TRUE so we…
MigrateSource::$multikeySeparator protected property Used in the case of multiple key sources that need to use idlist.
MigrateSource::$numIgnored protected property Number of rows intentionally ignored (prepareRow() returned FALSE)
MigrateSource::$numProcessed protected property Number of rows we've at least looked at. 1
MigrateSource::$originalHighwater protected property The highwater mark at the beginning of the import operation.
MigrateSource::$skipCount protected property Whether this instance should not attempt to count the source.
MigrateSource::$trackChanges protected property If TRUE, we will maintain hashed source rows to determine whether incoming data has changed.
MigrateSource::count public function Return a count of available source records, from the cache if appropriate. Returns -1 if the source is not countable.
MigrateSource::current public function Implementation of Iterator::current() - called when entering a loop iteration, returning the current row
MigrateSource::dataChanged protected function Determine whether this row has changed, and therefore whether it should be processed.
MigrateSource::getCurrentKey public function
MigrateSource::getIgnored public function
MigrateSource::getProcessed public function
MigrateSource::hash protected function Generate a hash of the source row. 3
MigrateSource::key public function Implementation of Iterator::key - called when entering a loop iteration, returning the key of the current row. It must be a scalar - we will serialize to fulfill the requirement, but using getCurrentKey() is preferable.
MigrateSource::next public function Implementation of Iterator::next() - subclasses of MigrateSource should implement getNextRow() to retrieve the next valid source rocord to process.
MigrateSource::prepareRow protected function Give the calling migration a shot at manipulating, and possibly rejecting, the source row.
MigrateSource::resetStats public function Reset numIgnored back to 0.
MigrateSource::rewind public function Implementation of Iterator::rewind() - subclasses of MigrateSource should implement performRewind() to do any class-specific setup for iterating source records.
MigrateSource::valid public function Implementation of Iterator::valid() - called at the top of the loop, returning TRUE to process the loop and FALSE to terminate it
MigrateSourceEntityReference::getNextRow public function Fetch the next row of data, returning it as an object. Return FALSE when there is no more data available.
MigrateSourceEntityReference::__construct function Constructor. Overrides MigrateSourceReference::__construct
MigrateSourceReference::$fields protected property Machine names of fields that will be imported.
MigrateSourceReference::$field_type protected property Field type.
MigrateSourceReference::$next_row protected property ID of a row, that will be imported during next iteration.
MigrateSourceReference::$result protected property Place where data is stored during import.
MigrateSourceReference::computeCount public function Return the number of available source records.
MigrateSourceReference::fields public function Returns a list of fields available to be mapped from the source, keyed by field name. Overrides MigrateSource::fields
MigrateSourceReference::performRewind public function Do whatever needs to be done to start a fresh traversal of the source data.
MigrateSourceReference::_constructRow protected function Constructs row object, that should be returned from $this->getNextRow().
MigrateSourceReference::__toString public function Return a string representing the source, for display in the UI.