commit c248d0f3f51ef0c0f97654144da49b130123c5fd Author: benjy Date: Sun Mar 9 19:00:28 2014 +0800 Removed MigrateProcessPluginManager diff --git a/core/modules/migrate/lib/Drupal/migrate/Entity/Migration.php b/core/modules/migrate/lib/Drupal/migrate/Entity/Migration.php index 3b64ab5..f456af0 100644 --- a/core/modules/migrate/lib/Drupal/migrate/Entity/Migration.php +++ b/core/modules/migrate/lib/Drupal/migrate/Entity/Migration.php @@ -88,6 +88,13 @@ class Migration extends ConfigEntityBase implements MigrationInterface, Requirem public $process; /** + * The cached process plugins. + * + * @var array + */ + protected $processPlugins = array(); + + /** * The destination configuration, with at least a 'plugin' key. * * Used to initialize $destinationPlugin. @@ -207,23 +214,25 @@ public function getProcessPlugins(array $process = NULL) { if (!isset($process)) { $process = $this->process; } - $process_plugins = array(); - foreach ($this->getProcessNormalized($process) as $property => $configurations) { - $process_plugins[$property] = array(); - foreach ($configurations as $configuration) { - if (isset($configuration['source'])) { - $process_plugins[$property][] = \Drupal::service('plugin.manager.migrate.process')->createInstance('get', $configuration, $this); - } - // Get is already handled. - if ($configuration['plugin'] != 'get') { - $process_plugins[$property][] = \Drupal::service('plugin.manager.migrate.process')->createInstance($configuration['plugin'], $configuration, $this); - } - if (!$process_plugins[$property]) { - throw new MigrateException("Invalid process configuration for $property"); + $index = serialize($process); + if (!isset($this->processPlugins[$index])) { + foreach ($this->getProcessNormalized($process) as $property => $configurations) { + $this->processPlugins[$index][$property] = array(); + foreach ($configurations as $configuration) { + if (isset($configuration['source'])) { + $this->processPlugins[$index][$property][] = \Drupal::service('plugin.manager.migrate.process')->createInstance('get', $configuration, $this); + } + // Get is already handled. + if ($configuration['plugin'] != 'get') { + $this->processPlugins[$index][$property][] = \Drupal::service('plugin.manager.migrate.process')->createInstance($configuration['plugin'], $configuration, $this); + } + if (!$this->processPlugins[$index][$property]) { + throw new MigrateException("Invalid process configuration for $property"); + } } } } - return $process_plugins; + return $this->processPlugins[$index]; } /** diff --git a/core/modules/migrate/lib/Drupal/migrate/Plugin/MigrateProcessPluginManager.php b/core/modules/migrate/lib/Drupal/migrate/Plugin/MigrateProcessPluginManager.php deleted file mode 100644 index aecb5f4..0000000 --- a/core/modules/migrate/lib/Drupal/migrate/Plugin/MigrateProcessPluginManager.php +++ /dev/null @@ -1,42 +0,0 @@ -storage[$migration->id()][$plugin_id][$index])) { - $this->storage[$migration->id()][$plugin_id][$index] = parent::createInstance($plugin_id, $configuration, $migration); - } - return $this->storage[$migration->id()][$plugin_id][$index]; - } - -} diff --git a/core/modules/migrate/migrate.services.yml b/core/modules/migrate/migrate.services.yml index 86aabe1..8b9c0cd 100644 --- a/core/modules/migrate/migrate.services.yml +++ b/core/modules/migrate/migrate.services.yml @@ -10,8 +10,8 @@ services: class: Drupal\migrate\Plugin\MigratePluginManager arguments: [source, '@container.namespaces', '@cache.cache', '@language_manager', '@module_handler', 'Drupal\migrate\Annotation\MigrateSource'] plugin.manager.migrate.process: - class: Drupal\migrate\Plugin\MigrateProcessPluginManager - arguments: [process, '@container.namespaces', '@cache.cache', '@language_manager', '@module_handler'] + class: Drupal\migrate\Plugin\MigratePluginManager + arguments: [process, '@container.namespaces', '@cache.cache', '@language_manager', '@module_handler', 'Drupal\migrate\Annotation\MigrateProcessPlugin'] plugin.manager.migrate.destination: class: Drupal\migrate\Plugin\MigrateDestinationPluginManager arguments: [destination, '@container.namespaces', '@cache.cache', '@language_manager', '@module_handler', '@theme_handler', '@entity.manager']