When migrating from a Drupal 7 site I get the following error when using stubs and Migrate 2.8

Argument 1 passed to                [error]
OttawaNodeMigration::createStub() must be an instance of Migration, null given, called in
sites/all/modules/migrate_d2d/d7/node.inc on line 97

Looking at the code the stub being generated for a translation node sends a NULL.

          $query = clone $this->query();
          $query->condition('n.nid', $row->tnid);
          $nid = $query->execute()->fetchField();
          unset($query);
          if ($nid) {
            if ($tnids = $this->createStub(NULL)) {
              // Save the mapping.
              $this->map->saveIDMapping((object) array('nid' => $row->tnid), $tnids, MigrateMap::STATUS_NEEDS_UPDATE, $this->defaultRollbackAction);
              $row->tnid = reset($tnids);
            }
          }
        }

Instead it should send something like this:

          $query = clone $this->query();
          $query->condition('n.nid', $row->tnid);
          $nid = $query->execute()->fetchField();
          unset($query);
          if ($nid) {
            if ($tnids = $this->createStub($this, array($nid))) {
              // Save the mapping.
              $this->map->saveIDMapping((object) array('nid' => $row->tnid), $tnids, MigrateMap::STATUS_NEEDS_UPDATE, $this->defaultRollbackAction);
              $row->tnid = reset($tnids);
            }
          }
        }

Patch coming.

CommentFileSizeAuthor
#2 2789643-nullgiven.patch629 bytesminoroffense

Comments

minorOffense created an issue. See original summary.

minoroffense’s picture

Status: Active » Needs review
StatusFileSize
new629 bytes