You are here

protected function PluginEventSubscriber::invoke in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate/src/Plugin/PluginEventSubscriber.php \Drupal\migrate\Plugin\PluginEventSubscriber::invoke()

Tries to invoke event handling methods on source and destination plugins.

Parameters

string $method: The method to invoke.

\Drupal\migrate\Event\MigrateImportEvent|\Drupal\migrate\Event\MigrateRollbackEvent $event: The event that has triggered the invocation.

string $plugin_interface: The interface which plugins must implement in order to be invoked.

4 calls to PluginEventSubscriber::invoke()
PluginEventSubscriber::postImport in core/modules/migrate/src/Plugin/PluginEventSubscriber.php
Forwards post-import events to the source and destination plugins.
PluginEventSubscriber::postRollback in core/modules/migrate/src/Plugin/PluginEventSubscriber.php
Forwards post-rollback events to the source and destination plugins.
PluginEventSubscriber::preImport in core/modules/migrate/src/Plugin/PluginEventSubscriber.php
Forwards pre-import events to the source and destination plugins.
PluginEventSubscriber::preRollback in core/modules/migrate/src/Plugin/PluginEventSubscriber.php
Forwards pre-rollback events to the source and destination plugins.

File

core/modules/migrate/src/Plugin/PluginEventSubscriber.php, line 27

Class

PluginEventSubscriber
Event subscriber to forward Migrate events to source and destination plugins.

Namespace

Drupal\migrate\Plugin

Code

protected function invoke($method, $event, $plugin_interface) {
  $migration = $event
    ->getMigration();
  $source = $migration
    ->getSourcePlugin();
  if ($source instanceof $plugin_interface) {
    call_user_func([
      $source,
      $method,
    ], $event);
  }
  $destination = $migration
    ->getDestinationPlugin();
  if ($destination instanceof $plugin_interface) {
    call_user_func([
      $destination,
      $method,
    ], $event);
  }
}