You are here

protected function D6WebformSubmission::buildSubmittedData in Webform: Migrate 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/migrate/source/d6/D6WebformSubmission.php \Drupal\webform_migrate\Plugin\migrate\source\d6\D6WebformSubmission::buildSubmittedData()

Build submitted data from webform submitted data table.

1 call to D6WebformSubmission::buildSubmittedData()
D6WebformSubmission::prepareRow in src/Plugin/migrate/source/d6/D6WebformSubmission.php
Adds additional data to the row.

File

src/Plugin/migrate/source/d6/D6WebformSubmission.php, line 81

Class

D6WebformSubmission
Drupal 6 webform submission source from database.

Namespace

Drupal\webform_migrate\Plugin\migrate\source\d6

Code

protected function buildSubmittedData($sid) {
  $query = $this
    ->select('webform_submitted_data', 'wfsd');
  $query
    ->innerJoin('webform_component', 'wc', 'wc.nid=wfsd.nid AND wc.cid=wfsd.cid');
  $query
    ->fields('wfsd', [
    'no',
    'data',
  ])
    ->fields('wc', [
    'form_key',
    'extra',
  ]);
  $wf_submissions = $query
    ->condition('sid', $sid)
    ->execute();
  $submitted_data = [];
  foreach ($wf_submissions as $wf_submission) {
    $extra = unserialize($wf_submission['extra']);
    if (!empty($extra['multiple'])) {
      $item[$wf_submission['no']] = $wf_submission['data'];
    }
    else {
      $item = $wf_submission['data'];
    }
    $submitted_data[$wf_submission['form_key']] = $item;
  }
  return $submitted_data;
}