MigrateSkipProcessException example

    if (is_array($plugin_id)) {
      $plugin_id = implode(':', $plugin_id);
    }

    if ($this->filterManager->hasDefinition($plugin_id)) {
      return $plugin_id;
    }
    else {
      if (in_array(static::getSourceFilterType($value)[FilterInterface::TYPE_TRANSFORM_REVERSIBLE, FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE], TRUE)) {
        $message = sprintf('Filter %s could not be mapped to an existing filter plugin; omitted since it is a transformation-only filter. Install and configure a successor after the migration.', $plugin_id);
        $migrate_executable->saveMessage($message, MigrationInterface::MESSAGE_INFORMATIONAL);
        throw new MigrateSkipProcessException("The transformation-only filter $plugin_id was skipped.");
      }
      $fallback = $this->filterManager->getFallbackPluginId($plugin_id);

      // @see \Drupal\filter\Plugin\migrate\process\FilterSettings::transform()       $message = sprintf('Filter %s could not be mapped to an existing filter plugin; defaulting to %s and dropping all settings. Either redo the migration with the module installed that provides an equivalent filter, or modify the text format after the migration to remove this filter if it is no longer necessary.', $plugin_id$fallback);
      $migrate_executable->saveMessage($message, MigrationInterface::MESSAGE_WARNING);

      return $fallback;
    }
  }

  

  public function process($value, MigrateExecutableInterface $migrate_executable, Row $row$destination_property) {
    if (!$value) {
      throw new MigrateSkipProcessException();
    }
    return $value;
  }

}
/** * Skips the migration process entirely if the value is invalid. * * @param array $value * The incoming value to check. * * @throws \Drupal\migrate\MigrateSkipProcessException */
  protected function skipInvalid(array $value) {
    if (!array_filter($value[$this, 'isValid'])) {
      throw new MigrateSkipProcessException();
    }
  }

  /** * Determines if the value is valid for lookup. * * The only values considered invalid are: NULL, FALSE, [] and "". * * @param string $value * The value to test. * * @return bool * Return true if the value is valid. */
Home | Imprint | This part of the site doesn't use cookies.