Commit 5421fdee authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2624660 by Lars Toomre: Some fixes to migrate/src/Plugin/*.php files

parent 1a6baa4c
Loading
Loading
Loading
Loading
+2 −2
Changes for core/modules/migrate/src/Plugin/MigrateBuilderInterface.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -11,8 +11,8 @@
 * Defines the builder plugin type.
 *
 * Builder plugins implement custom logic to generate migration entities from
 * migration templates. For example, a migration may need to be customized
 * based on data that's present in the source database; such customization is
 * migration templates. For example, a migration may need to be customized based
 * on data that's present in the source database; such customization is
 * implemented by builders.
 */
interface MigrateBuilderInterface {
+5 −3
Changes for core/modules/migrate/src/Plugin/MigrateDestinationInterface.php: 5 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -12,6 +12,8 @@
use Drupal\migrate\Row;

/**
 * Defines an interface for Migration Destination classes.
 *
 * Destinations are responsible for persisting source data into the destination
 * Drupal.
 *
@@ -43,11 +45,11 @@ public function getIds();
   * Derived classes must implement fields(), returning a list of available
   * destination fields.
   *
   * @todo Review the cases where we need the Migration parameter,
   * can we avoid that?
   * @todo Review the cases where we need the Migration parameter, can we avoid
   *   that? To be resolved with https://www.drupal.org/node/2543568.
   *
   * @param \Drupal\migrate\Entity\MigrationInterface $migration
   *   (optional) The migration containing this destination.
   *   (optional) The migration containing this destination. Defaults to NULL.
   *
   * @return array
   *   - Keys: machine names of the fields
+2 −2
Changes for core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@
 * Contains \Drupal\migrate\Plugin\MigrateDestinationPluginManager.
 */


namespace Drupal\migrate\Plugin;

use Drupal\Core\Cache\CacheBackendInterface;
@@ -48,7 +47,8 @@ class MigrateDestinationPluginManager extends MigratePluginManager {
   * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
   *   The entity manager.
   * @param string $annotation
   *   The annotation class name.
   *   (optional) The annotation class name. Defaults to
   *   'Drupal\migrate\Annotation\MigrateDestination'.
   */
  public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, EntityManagerInterface $entity_manager, $annotation = 'Drupal\migrate\Annotation\MigrateDestination') {
    parent::__construct($type, $namespaces, $cache_backend, $module_handler, $annotation);
+13 −9
Changes for core/modules/migrate/src/Plugin/MigrateIdMapInterface.php: 13 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -37,8 +37,8 @@ interface MigrateIdMapInterface extends \Iterator, PluginInspectionInterface {
  /**
   * Saves a mapping from the source identifiers to the destination identifiers.
   *
   * Called upon import of one row, we record a mapping from the source ID
   * to the destination ID. Also may be called, setting the third parameter to
   * Called upon import of one row, we record a mapping from the source ID to
   * the destination ID. Also may be called, setting the third parameter to
   * NEEDS_UPDATE, to signal an existing record should be re-migrated.
   *
   * @param \Drupal\migrate\Row $row
@@ -47,9 +47,11 @@ interface MigrateIdMapInterface extends \Iterator, PluginInspectionInterface {
   * @param array $destination_id_values
   *   An array of destination identifier values.
   * @param int $status
   *   Status of the source row in the map.
   *   (optional) Status of the source row in the map. Defaults to
   *   self::STATUS_IMPORTED.
   * @param int $rollback_action
   *   How to handle the destination object on rollback.
   *   (optional) How to handle the destination object on rollback. Defaults to
   *   self::ROLLBACK_DELETE.
   */
  public function saveIdMapping(Row $row, array $destination_id_values, $status = self::STATUS_IMPORTED, $rollback_action = self::ROLLBACK_DELETE);

@@ -61,7 +63,8 @@ public function saveIdMapping(Row $row, array $destination_id_values, $status =
   * @param string $message
   *   The message to record.
   * @param int $level
   *   Optional message severity (defaults to MESSAGE_ERROR).
   *   (optional) The message severity. Defaults to
   *   MigrationInterface::MESSAGE_ERROR.
   */
  public function saveMessage(array $source_id_values, $message, $level = MigrationInterface::MESSAGE_ERROR);

@@ -69,10 +72,11 @@ public function saveMessage(array $source_id_values, $message, $level = Migratio
   * Retrieves an iterator over messages relate to source records.
   *
   * @param array $source_id_values
   *   (optional) The source identifier keyed values of the record, e.g. ['nid' => 5].
   *   If empty, all messages are retrieved.
   *   (optional) The source identifier keyed values of the record, e.g.
   *   ['nid' => 5]. If empty (the default), all messages are retrieved.
   * @param int $level
   *   (optional) Message severity. If NULL, retrieve messages of all severities.
   *   (optional) Message severity. If NULL (the default), retrieve messages of
   *   all severities.
   *
   * @return \Iterator
   *   Retrieves an iterator over the message rows.
@@ -136,7 +140,7 @@ public function messageCount();
   * @param array $source_id_values
   *   The source identifier keyed values of the record, e.g. ['nid' => 5].
   * @param bool $messages_only
   *   TRUE to only delete the migrate messages.
   *   (optional) TRUE to only delete the migrate messages. Defaults to FALSE.
   */
  public function delete(array $source_id_values, $messages_only = FALSE);

+2 −1
Changes for core/modules/migrate/src/Plugin/MigratePluginManager.php: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -43,7 +43,8 @@ class MigratePluginManager extends DefaultPluginManager {
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler to invoke the alter hook with.
   * @param string $annotation
   *   The annotation class name.
   *   (optional) The annotation class name. Defaults to
   *   'Drupal\Component\Annotation\PluginID'.
   */
  public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, $annotation = 'Drupal\Component\Annotation\PluginID') {
    $plugin_interface = isset($plugin_interface_map[$type]) ? $plugin_interface_map[$type] : NULL;
Loading