/** * Test getRow method. * * @covers ::__construct * @covers ::getRow */ public function testGetRow() { $migration = $this->prophesize('\\Drupal\\migrate\\Plugin\\MigrationInterface')->reveal(); $message_service = $this->prophesize('\\Drupal\\migrate\\MigrateMessageInterface'); $row = $this->prophesize('\\Drupal\\migrate\\Row')->reveal(); $event = new MigratePostRowSaveEvent($migration, $message_service->reveal(), $row, [1, 2, 3]); $this->assertSame($row, $event->getRow()); }
/** * Reacts to item import. * * @param \Drupal\migrate\Event\MigratePostRowSaveEvent $event * The post-save event. */ public static function onPostRowSave(MigratePostRowSaveEvent $event) { // We want to interrupt this batch and start a fresh one. if (time() - REQUEST_TIME > static::$maxExecTime) { $event->getMigration()->interruptMigration(MigrationInterface::RESULT_INCOMPLETE); } }
/** * Reacts to post-row-save event. * * @param \Drupal\Migrate\Event\MigratePostRowSaveEvent $event * The migration event. * @param string $name * The event name. */ public function postRowSaveEventRecorder(MigratePostRowSaveEvent $event, $name) { $event->getMigration()->interruptMigration(MigrationInterface::RESULT_INCOMPLETE); }
/** * Reacts to post-row-save event. * * @param \Drupal\Migrate\Event\MigratePostRowSaveEvent $event * The migration event. * @param string $name * The event name. */ public function postRowSaveEventRecorder(MigratePostRowSaveEvent $event, $name) { $this->state->set('migrate_events_test.post_row_save_event', array('event_name' => $name, 'migration' => $event->getMigration(), 'row' => $event->getRow(), 'destination_id_values' => $event->getDestinationIdValues())); }
/** * React to item import. * * @param \Drupal\migrate\Event\MigratePostRowSaveEvent $event * The post-save event. */ public function onPostRowSave(MigratePostRowSaveEvent $event) { if ($this->feedback && $this->counter && $this->counter % $this->feedback == 0) { $this->progressMessage(FALSE); $this->resetCounters(); } $this->counter++; if ($this->itemLimit && $this->counter >= $this->itemLimit) { $event->getMigration()->interruptMigration(MigrationInterface::RESULT_COMPLETED); } }