I am trying to write a migrate source class (#1883112: Migrate SourceEntity? ), and so I've set up a test migration that works with it.

Because I don't want to create data, I've added a prepareRow() to my migration class which just returns FALSE, the idea being I can run this migration over and over again while outputting debug data, and get the source class right.

Unfortunately, after the first run of this, I don't get any results because of this:

      // 4. At this point, we have a row which has previously been imported and
      //    not marked for update. If we're not using highwater marks, then we
      //    will not take this row.
      elseif (empty($this->highwaterField)) {
        // No highwater, skip
        $this->currentRow = NULL;
        continue;
      }

Comments

mikeryan’s picture

Status: Active » Postponed (maintainer needs more info)

Can you explain a little more precisely the behavior that is getting in your way?

Thanks.

joachim’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

I'm not entirely sure myself -- this hit me when I was at that 'aaargh! firefighting!!!' stage of things, so I commented out the highwater bit just to get it to work :/

So, investigating more...

This is MigrateSource::next(), line 270 whose comment says:

      // First, determine if this row should be passed to prepareRow(), or skipped
      // entirely. The rules are:

Step 1 is skipped because there's no idList:

      if (!empty($this->idList)) {

Step 2 looks like it SHOULD pass:

      // 2. If the row is not in the map (we have never tried to import it before),
      //    we always want to try it.
      elseif (!isset($row->migrate_map_sourceid1)) {
        // Fall through
      }

So it's quite likely that this problem happened because I did an test import with my prepareRow() deliberately returning FALSE, just to see debug output, and forgot that even that needs to be rolled back for the migrate map to be reset.

I'll close this as works as designed and reopen if I find problems with this again :)