You are here

public function SpreadsheetIterator::getRowIndexColumn in Migrate Spreadsheet 8

Same name and namespace in other branches
  1. 2.0.x src/SpreadsheetIterator.php \Drupal\migrate_spreadsheet\SpreadsheetIterator::getRowIndexColumn()

Gets the name of the row index column.

Return value

string A name to be given to the column returning the numeric index of the row.

Overrides SpreadsheetIteratorInterface::getRowIndexColumn

3 calls to SpreadsheetIterator::getRowIndexColumn()
SpreadsheetIterator::current in src/SpreadsheetIterator.php
SpreadsheetIterator::getKeys in src/SpreadsheetIterator.php
Gets the list of columns that are composing the primary key.
SpreadsheetIterator::key in src/SpreadsheetIterator.php

File

src/SpreadsheetIterator.php, line 237

Class

SpreadsheetIterator
Provides a spreadsheet iterator.

Namespace

Drupal\migrate_spreadsheet

Code

public function getRowIndexColumn() {
  $column = empty($this->configuration['row_index_column']) ? NULL : $this->configuration['row_index_column'];
  if ($column) {
    $headers = $this
      ->getHeaders();
    if (isset($headers[$column])) {
      throw new \InvalidArgumentException("The header column '{$column}' cannot be used as 'row_index_column'. Chose a value for 'row_index_column' that doesn't exist in header cells.");
    }
  }
  return $column;
}