You are here

public function MerciLineItem::prepareRow in MERCI (Manage Equipment Reservations, Checkout and Inventory) 8.2

Adds additional data to the row.

Parameters

\Drupal\migrate\Row $row: The row object.

Return value

bool FALSE if this row needs to be skipped.

Overrides SourcePluginBase::prepareRow

File

modules/merci_migration/src/Plugin/migrate/source/d7/MerciLineItem.php, line 111

Class

MerciLineItem
Drupal 7 node source from database.

Namespace

Drupal\merci_migration\Plugin\migrate\source\d7

Code

public function prepareRow(Row $row) {

  // Get Field API field values.
  $nid = $row
    ->getSourceProperty('nid');
  $vid = $row
    ->getSourceProperty('vid');
  foreach (array_keys($this
    ->getFields('node', $row
    ->getSourceProperty('type'))) as $field) {
    $row
      ->setSourceProperty($field, $this
      ->getFieldValues('node', $field, $nid, $vid));
  }

  // Get Field API field values.
  $nid = $row
    ->getSourceProperty('reservation_nid');
  $vid = $row
    ->getSourceProperty('reservation_vid');
  foreach (array_keys($this
    ->getFields('node', 'merci_reservation')) as $field) {
    $row
      ->setSourceProperty($field, $this
      ->getFieldValues('node', $field, $nid, $vid));
  }

  // Make sure we always have a translation set.
  if ($row
    ->getSourceProperty('tnid') == 0) {
    $row
      ->setSourceProperty('tnid', $row
      ->getSourceProperty('nid'));
  }
  return parent::prepareRow($row);
}