You are here

class IdMapFilter in Migrate Tools 8.5

Same name and namespace in other branches
  1. 8.4 src/IdMapFilter.php \Drupal\migrate_tools\IdMapFilter

Class to filter ID map by an ID list.

Hierarchy

  • class \Drupal\migrate_tools\IdMapFilter extends \Drupal\migrate_tools\FilterIterator

Expanded class hierarchy of IdMapFilter

1 file declares its use of IdMapFilter
MigrateToolsCommands.php in src/Commands/MigrateToolsCommands.php

File

src/IdMapFilter.php, line 10

Namespace

Drupal\migrate_tools
View source
class IdMapFilter extends \FilterIterator {

  /**
   * List of specific source IDs to import.
   *
   * @var array
   */
  protected $idList;

  /**
   * IdMapFilter constructor.
   *
   * @param \Drupal\migrate\Plugin\MigrateIdMapInterface $id_map
   *   The ID map.
   * @param array $id_list
   *   The id list to use in the filter.
   */
  public function __construct(MigrateIdMapInterface $id_map, array $id_list) {
    parent::__construct($id_map);
    $this->idList = $id_list;
  }

  /**
   * {@inheritdoc}
   */
  public function accept() {

    // Row is included.
    if (empty($this->idList) || in_array(array_values($this
      ->getInnerIterator()
      ->currentSource()), $this->idList)) {
      return TRUE;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
IdMapFilter::$idList protected property List of specific source IDs to import.
IdMapFilter::accept public function
IdMapFilter::__construct public function IdMapFilter constructor.