You are here

public function RoleWatchdog::prepareRow in Role Watchdog 8

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

src/Plugin/migrate/source/d6/RoleWatchdog.php, line 32

Class

RoleWatchdog
Drupal 6 role watchdog source from database.

Namespace

Drupal\role_watchdog\Plugin\migrate\source\d6

Code

public function prepareRow(Row $row) {
  $aid = $row
    ->getSourceProperty('aid');
  $action = $row
    ->getSourceProperty('action');
  $uid = $row
    ->getSourceProperty('uid');
  $stamp = $row
    ->getSourceProperty('stamp');
  $query = $this
    ->select('role_watchdog', 'rw')
    ->fields('rw', [
    'rid',
  ]);
  $query
    ->condition('aid', $aid);
  $query
    ->condition('action', $action);
  $query
    ->condition('uid', $uid);
  $query
    ->condition('stamp', $stamp);
  $result = $query
    ->execute()
    ->fetchCol();

  // Prepare associated array for migration subprocess plugin.
  $rid = [];
  foreach ($result as $value) {
    $rid[] = [
      'value' => $value,
    ];
  }
  $row
    ->setSourceProperty('rid', $rid);
  return parent::prepareRow($row);
}