You are here

public function WebformNode::prepareRow in Migrate Webform 7

Called after the query data is fetched - we'll use this to populate the source row with the CCK fields.

Overrides DrupalNode6Migration::prepareRow

File

./node.inc, line 35

Class

WebformNode
Handling specific to a Drupal 6 source for nodes.

Code

public function prepareRow($row) {

  // skip?
  if (parent::prepareRow($row) === FALSE) {
    return FALSE;
  }
  $result = db_query('select * from webform_roles where nid=:nid', array(
    ':nid' => $row->nid,
  ), array(
    'target' => $this->source_db,
  ));

  // deal with role mappings
  foreach ($result as $item) {
    if (isset($this->roles[$item->rid]['new'])) {
      $row->roles[] = $this->roles[$item->rid]['new'];
    }
    else {
      $row->roles = array(
        1,
        2,
      );
    }
  }
  if (sizeof($row->roles == 0)) {
    $row->roles = array(
      1,
      2,
    );
  }
}