0

I have a talent for finding the hard issues. I have a custom migration class importing taxonomy terms. The class is an in-house customization, and we have it working happily on other sites. On my site, it is not working. There is a chance this is related to the data, which is coming from the client and possibly not clean. Here is my issue. I am implementing the public function prepareRow($current_row) with the intent of skipping some rows that I know will cause trouble. Specifically, anything with a non-numeric id value.

  1. I know the function is called, I see "Gojira!" appear

  2. I know the value that is causing an error

  3. The function is not being respected by the system.

Here is my function:

public function prepareRow($current_row) {
  $safe = FALSE;
  if(is_numeric($current_row->id)){
    $safe = TRUE;
    // problem value is $current_row->id == 'n'
  }
  if(!$safe) {
    print('Gojira!'); // this is seen in the migration ui
    //die();  // this is ignored
    return FALSE; // this is ignored
  }

  // allow parent to skip a row
  if (parent::prepareRow($current_row) === FALSE) {
    return FALSE;
  }
}

Here is the error I see on the migration ui page:

Migration failed ... General error: 1366 Incorrect integer value: 'n' for column 'sourceid1' at row 1

Please help.

0

The hint that solved this was in the error message:

for column 'sourceid1' 

This column is in the Migration class's map table, where it tries to make a record of what it has processed. The "fix" for this is to prevent the errant data from getting that far in the system. I am coding a custom getItem to do the filtering for this issue there.

0

Maybe it can help.

    // Row object containing the specific item just imported.
    $row = $event->getRow();

    if (!$row->needsUpdate()) {
      return;
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.