Commit 6f6f0b8a authored by heddn's avatar heddn Committed by heddn

Issue #2933908 by heddn: Update phpcs.xml

parent ae1b7c2a
This diff is collapsed.
......@@ -9,7 +9,8 @@
* Implements hook_entity_type_build().
*/
function migrate_tools_entity_type_build(array &$entity_types) {
// Inject our UI into the general migration and migration group config entities.
// Inject our UI into the general migration and migration group config
// entities.
/** @var \Drupal\Core\Config\Entity\ConfigEntityType[] $entity_types */
$entity_types['migration']
->set('admin_permission', 'administer migrations')
......
services:
logger.channel.migrate_tools:
class: Drupal\Core\Logger\LoggerChannel
factory: logger.factory:get
arguments: ['migrate_tools']
This diff is collapsed.
......@@ -12,10 +12,8 @@ use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\MigrationPluginManager;
use Drupal\migrate\Plugin\RequirementsInterface;
use Drupal\migrate_tools\Drush9LogMigrateMessage;
use Drupal\migrate_tools\DrushLogMigrateMessage;
use Drupal\migrate_tools\MigrateExecutable;
use Drush\Commands\DrushCommands;
use Drush\Drush;
/**
* Migrate Tools drush commands.
......
......@@ -83,7 +83,7 @@ class MessageController extends ControllerBase {
public function overview($migration_group, $migration) {
$rows = [];
$classes = static::getLogLevelClassMap();
/** @var MigrationInterface $migration */
/** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
$migration = $this->migrationPluginManager->createInstance($migration);
$source_id_field_names = array_keys($migration->getSourcePlugin()->getIds());
$column_number = 1;
......
......@@ -34,13 +34,13 @@ class MigrationGroupListBuilder extends ConfigEntityListBuilder {
/**
* Builds a row for an entity in the entity listing.
*
* @param EntityInterface $entity
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity for which to build the row.
*
* @return array
* A render array of the table row for displaying the entity.
*
* @see Drupal\Core\Entity\EntityListController::render()
* @see \Drupal\Core\Entity\EntityListController::render()
*/
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity->label();
......
......@@ -8,6 +8,7 @@ use Drupal\Core\Entity\EntityHandlerInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\Core\Routing\CurrentRouteMatch;
use Drupal\migrate\Plugin\MigrationPluginManagerInterface;
use Drupal\migrate_plus\Entity\MigrationGroup;
......@@ -37,6 +38,13 @@ class MigrationListBuilder extends ConfigEntityListBuilder implements EntityHand
*/
protected $migrationPluginManager;
/**
* The logger service.
*
* @var \Drupal\Core\Logger\LoggerChannelInterface
*/
protected $logger;
/**
* Constructs a new EntityListBuilder object.
*
......@@ -48,11 +56,14 @@ class MigrationListBuilder extends ConfigEntityListBuilder implements EntityHand
* The current route match service.
* @param \Drupal\migrate\Plugin\MigrationPluginManagerInterface $migration_plugin_manager
* The plugin manager for config entity-based migrations.
* @param \Drupal\Core\Logger\LoggerChannelInterface $logger
* The logger service.
*/
public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, CurrentRouteMatch $current_route_match, MigrationPluginManagerInterface $migration_plugin_manager) {
public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, CurrentRouteMatch $current_route_match, MigrationPluginManagerInterface $migration_plugin_manager, LoggerChannelInterface $logger) {
parent::__construct($entity_type, $storage);
$this->currentRouteMatch = $current_route_match;
$this->migrationPluginManager = $migration_plugin_manager;
$this->logger = $logger;
}
/**
......@@ -63,7 +74,8 @@ class MigrationListBuilder extends ConfigEntityListBuilder implements EntityHand
$entity_type,
$container->get('entity.manager')->getStorage($entity_type->id()),
$container->get('current_route_match'),
$container->get('plugin.manager.migration')
$container->get('plugin.manager.migration'),
$container->get('logger.channel.migrate_tools')
);
}
......@@ -121,7 +133,7 @@ class MigrationListBuilder extends ConfigEntityListBuilder implements EntityHand
* @param \Drupal\Core\Entity\EntityInterface $migration_entity
* The migration plugin for which to build the row.
*
* @return array
* @return array|null
* A render array of the table row for displaying the plugin information.
*
* @see \Drupal\Core\Entity\EntityListController::render()
......@@ -147,7 +159,9 @@ class MigrationListBuilder extends ConfigEntityListBuilder implements EntityHand
];
$row['machine_name'] = $migration->id();
$row['status'] = $migration->getStatusLabel();
} catch (PluginException $e) {
}
catch (PluginException $e) {
$this->logger->warning('Migration entity id %id is malformed', ['%id' => $migration_entity->id()]);
return NULL;
}
......@@ -196,7 +210,8 @@ class MigrationListBuilder extends ConfigEntityListBuilder implements EntityHand
],
],
];
} catch (PluginException $e) {
}
catch (PluginException $e) {
// Derive the stats.
$row['status'] = $this->t('No data found');
$row['total'] = $this->t('N/A');
......@@ -211,10 +226,11 @@ class MigrationListBuilder extends ConfigEntityListBuilder implements EntityHand
}
/**
* Add group route parameter.
*
* @param \Drupal\Core\Url $url
* The URL associated with an operation.
*
* @param $migration_group
* @param string $migration_group
* The migration's parent group.
*/
protected function addGroupParameter(Url $url, $migration_group) {
......
......@@ -4,6 +4,11 @@ namespace Drupal\migrate_tools;
use Drupal\migrate\MigrateMessageInterface;
/**
* Class DrushLogMigrateMessage.
*
* @package Drupal\migrate_tools
*/
class DrushLogMigrateMessage implements MigrateMessageInterface {
/**
......
......@@ -7,7 +7,7 @@ use Drupal\Core\Url;
use Drupal\Core\Form\FormStateInterface;
/**
* Class MigrationDeleteForm.
* Provides the delete form for our Migration entity.
*
* @package Drupal\migrate_tools\Form
*
......@@ -23,7 +23,7 @@ class MigrationDeleteForm extends EntityConfirmFormBase {
*/
public function getQuestion() {
return $this->t('Are you sure you want to delete migration %label?', [
'%label' => $this->entity->label(),
'%label' => $this->entity->label(),
]);
}
......
......@@ -6,8 +6,6 @@ use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
* Class MigrationEditForm
*
* Provides the edit form for our Migration entity.
*
* @package Drupal\migrate_tools\Form
......@@ -37,10 +35,11 @@ class MigrationEditForm extends MigrationFormBase {
}
/**
* Add group route parameter.
*
* @param \Drupal\Core\Url $url
* The URL associated with an operation.
*
* @param $migration_group
* @param string $migration_group
* The migration's parent group.
*/
protected function addGroupParameter(Url $url, $migration_group) {
......
<?php
/**
* @file
* Contains \Drupal\migrate_tools\Form\MigrationExecuteForm
*/
namespace Drupal\migrate_tools\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Form\FormBase;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\MigrateMessage;
use Drupal\migrate\MigrateMessageInterface;
use Drupal\migrate\Plugin\Migration;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\MigrationPluginManagerInterface;
use Drupal\migrate_tools\MigrateBatchExecutable;
use Drupal\migrate_tools\MigrateExecutable;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
......@@ -129,13 +120,7 @@ class MigrationExecuteForm extends FormBase {
completed.'),
];
// @TODO: Limit is not working. Perhaps because of batch? See
// https://www.drupal.org/project/migrate_tools/issues/2924298
// $form['options']['limit'] = [
// '#type' => 'textfield',
// '#title' => t('Limit to:'),
// '#size' => 10,
// '#description' => t('Set a limit of how many items to process for each migration task.'),
// ];
// https://www.drupal.org/project/migrate_tools/issues/2924298.
return $form;
}
......@@ -181,7 +166,7 @@ class MigrationExecuteForm extends FormBase {
if ($migration_name) {
/** @var MigrationInterface $migration */
/** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
$migration = $this->migrationPluginManager->createInstance($migration_name);
$migrateMessage = new MigrateMessage();
......@@ -204,7 +189,7 @@ class MigrationExecuteForm extends FormBase {
$options = [
'limit' => $limit,
'update' => $update,
'force' => $force
'force' => $force,
];
$executable = new MigrateBatchExecutable($migration, $migrateMessage, $options);
......
......@@ -18,6 +18,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class MigrationFormBase extends EntityForm {
/**
* The entity query factory.
*
* @var \Drupal\Core\Entity\Query\QueryFactory
*/
protected $entityQueryFactory;
......@@ -25,8 +27,8 @@ class MigrationFormBase extends EntityForm {
/**
* Construct the MigrationGroupFormBase.
*
* For simple entity forms, there's no need for a constructor. Our migration form
* base, however, requires an entity query factory to be injected into it
* For simple entity forms, there's no need for a constructor. Our migration
* form base, however, requires an entity query factory to be injected into it
* from the container. We later use this query factory to build an entity
* query for the exists() method.
*
......@@ -38,12 +40,7 @@ class MigrationFormBase extends EntityForm {
}
/**
* Factory method for MigrationFormBase.
*
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* A container interface service.
*
* @return \Drupal\migrate_tools\Form\MigrationGroupFormBase
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container->get('entity.query'));
......@@ -72,7 +69,7 @@ class MigrationFormBase extends EntityForm {
$form['warning'] = [
'#markup' => $this->t('Creating migrations is not yet supported. See <a href=":url">:url</a>', [
':url' => 'https://www.drupal.org/node/2573241',
])
]),
];
// Build the form.
......@@ -123,7 +120,7 @@ class MigrationFormBase extends EntityForm {
* The entity ID.
* @param array $element
* The form element.
* @param FormStateInterface $form_state
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*
* @return bool
......@@ -164,14 +161,7 @@ class MigrationFormBase extends EntityForm {
}
/**
* Overrides Drupal\Core\Entity\EntityFormController::save().
*
* @param array $form
* An associative array containing the structure of the form.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* An associative array containing the current state of the form.
*
* @return $this
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state) {
$migration = $this->getEntity();
......
......@@ -7,7 +7,7 @@ use Drupal\Core\Url;
use Drupal\Core\Form\FormStateInterface;
/**
* Class MigrationGroupDeleteForm.
* Provides the delete form for our Migration Group entity.
*
* @package Drupal\migrate_tools\Form
*
......@@ -23,7 +23,7 @@ class MigrationGroupDeleteForm extends EntityConfirmFormBase {
*/
public function getQuestion() {
return $this->t('Are you sure you want to delete migration group %label?', [
'%label' => $this->entity->label(),
'%label' => $this->entity->label(),
]);
}
......
......@@ -5,8 +5,6 @@ namespace Drupal\migrate_tools\Form;
use Drupal\Core\Form\FormStateInterface;
/**
* Class MigrationGroupEditForm
*
* Provides the edit form for our Migration Group entity.
*
* @package Drupal\migrate_tools\Form
......
......@@ -17,6 +17,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class MigrationGroupFormBase extends EntityForm {
/**
* The query factory service.
*
* @var \Drupal\Core\Entity\Query\QueryFactory
*/
protected $entityQueryFactory;
......@@ -24,10 +26,10 @@ class MigrationGroupFormBase extends EntityForm {
/**
* Construct the MigrationGroupFormBase.
*
* For simple entity forms, there's no need for a constructor. Our migration group form
* base, however, requires an entity query factory to be injected into it
* from the container. We later use this query factory to build an entity
* query for the exists() method.
* For simple entity forms, there's no need for a constructor. Our migration
* group form base, however, requires an entity query factory to be injected
* into it from the container. We later use this query factory to build an
* entity query for the exists() method.
*
* @param \Drupal\Core\Entity\Query\QueryFactory $query_factory
* An entity query factory for the migration group entity type.
......@@ -37,12 +39,7 @@ class MigrationGroupFormBase extends EntityForm {
}
/**
* Factory method for MigrationGroupFormBase.
*
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* A container interface service.
*
* @return \Drupal\migrate_tools\Form\MigrationFormBase
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container->get('entity.query'));
......@@ -112,7 +109,7 @@ class MigrationGroupFormBase extends EntityForm {
* The entity ID.
* @param array $element
* The form element.
* @param FormStateInterface $form_state
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*
* @return bool
......@@ -153,14 +150,7 @@ class MigrationGroupFormBase extends EntityForm {
}
/**
* Overrides Drupal\Core\Entity\EntityFormController::save().
*
* @param array $form
* An associative array containing the structure of the form.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* An associative array containing the current state of the form.
*
* @return $this
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state) {
$migration_group = $this->getEntity();
......
......@@ -66,8 +66,9 @@ class MigrateBatchExecutable extends MigrateExecutable {
* Sets the current batch content so listeners can update the messages.
*
* @param array $context
* The batch context.
*/
public function setBatchContext(&$context) {
public function setBatchContext(array &$context) {
$this->batchContext = &$context;
}
......@@ -75,6 +76,7 @@ class MigrateBatchExecutable extends MigrateExecutable {
* Gets a reference to the current batch context.
*
* @return array
* The batch context.
*/
public function &getBatchContext() {
return $this->batchContext;
......@@ -90,7 +92,7 @@ class MigrateBatchExecutable extends MigrateExecutable {
$operations = $this->batchOperations([$this->migration], 'import', [
'limit' => $this->itemLimit,
'update' => $this->updateExistingRows,
'force' => $this->checkDependencies
'force' => $this->checkDependencies,
]);
if (count($operations) > 0) {
......@@ -110,20 +112,18 @@ class MigrateBatchExecutable extends MigrateExecutable {
/**
* Helper to generate the batch operations for importing migrations.
*
* @param array $migrations
* @param array $operation
* @param \Drupal\migrate\Plugin\MigrationInterface[] $migrations
* The migrations.
* @param string $operation
* The batch operation to perform.
* @param array $options
* The migration options.
*
* @return array
* The batch operations to perform.
*/
protected function batchOperations($migrations, $operation, $options = []) {
protected function batchOperations(array $migrations, $operation, array $options = []) {
$operations = [];
/**
* @var string $id
* @var Migration $migration
*/
foreach ($migrations as $id => $migration) {
if (!empty($options['update'])) {
......@@ -143,14 +143,14 @@ class MigrateBatchExecutable extends MigrateExecutable {
$operations += $this->batchOperations($required_migrations, $operation, [
'limit' => 0,
'update' => $options['update'],
'force' => $options['force']
'force' => $options['force'],
]);
}
}
$operations[] = [
'\Drupal\migrate_tools\MigrateBatchExecutable::batchProcessImport',
[$migration->id(), $options]
[$migration->id(), $options],
];
}
......@@ -158,15 +158,16 @@ class MigrateBatchExecutable extends MigrateExecutable {
}
/**
* Batch 'operation' callback
* Batch 'operation' callback.
*
* @param string $migration_id
* The migration id.
* @param array $options
* The batch executable options.
* @param array $context
*
* The sandbox context.
*/
static public function batchProcessImport($migration_id, $options, &$context) {
public static function batchProcessImport($migration_id, array $options, array &$context) {
if (empty($context['sandbox'])) {
$context['finished'] = 0;
$context['sandbox'] = [];
......@@ -178,7 +179,7 @@ class MigrateBatchExecutable extends MigrateExecutable {
// Prepare the migration executable.
$message = new MigrateMessage();
/** @var MigrationInterface $migration */
/** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
$migration = \Drupal::getContainer()->get('plugin.manager.migration')->createInstance($migration_id);
$executable = new MigrateBatchExecutable($migration, $message, $options);
......@@ -191,7 +192,7 @@ class MigrateBatchExecutable extends MigrateExecutable {
'@updated' => 0,
'@failures' => 0,
'@ignored' => 0,
'@name' => $migration->id()
'@name' => $migration->id(),
];
}
......@@ -204,14 +205,14 @@ class MigrateBatchExecutable extends MigrateExecutable {
// Do the import.
$result = $executable->import();
// Store the result, we will need to combine the results of all our iterations.
// Store the result; will need to combine the results of all our iterations.
$context['results'][$migration->id()] = [
'@numitems' => $context['results'][$migration->id()]['@numitems'] + $executable->getProcessedCount(),
'@created' => $context['results'][$migration->id()]['@created'] + $executable->getCreatedCount(),
'@updated' => $context['results'][$migration->id()]['@updated'] + $executable->getUpdatedCount(),
'@failures' => $context['results'][$migration->id()]['@failures'] + $executable->getFailedCount(),
'@ignored' => $context['results'][$migration->id()]['@ignored'] + $executable->getIgnoredCount(),
'@name' => $migration->id()
'@name' => $migration->id(),
];
// Do some housekeeping.
......@@ -226,7 +227,7 @@ class MigrateBatchExecutable extends MigrateExecutable {
$context['finished'] = ((float) $context['sandbox']['counter'] / (float) $context['sandbox']['total']);
$context['message'] = t('Importing %migration (@percent%).', [
'%migration' => $migration->label(),
'@percent' => (int) ($context['finished'] * 100)
'@percent' => (int) ($context['finished'] * 100),
]);
}
}
......@@ -236,12 +237,14 @@ class MigrateBatchExecutable extends MigrateExecutable {
/**
* Finished callback for import batches.
*
* @param $success
* @param $results
* @param $operations
* @param $elapsed
* @param bool $success
* A boolean indicating whether the batch has completed successfully.
* @param array $results
* The value set in $context['results'] by callback_batch_operation().
* @param array $operations
* If $success is FALSE, contains the operations that remained unprocessed.
*/
static public function batchFinishedImport($success, $results, $operations, $elapsed) {
public static function batchFinishedImport($success, array $results, array $operations) {
if ($success) {
foreach ($results as $migration_id => $result) {
$singular_message = "Processed 1 item (@created created, @updated updated, @failures failed, @ignored ignored) - done with '@name'";
......@@ -255,7 +258,7 @@ class MigrateBatchExecutable extends MigrateExecutable {
}
/**
* @inheritdoc
* {@inheritdoc}
*/
public function checkStatus() {
$status = parent::checkStatus();
......@@ -278,11 +281,13 @@ class MigrateBatchExecutable extends MigrateExecutable {
/**
* Calculates how much a single batch iteration will handle.
*
* @param $context
* @param array $context
* The sandbox context.
*
* @return float
* The batch limit.
*/
public function calculateBatchLimit($context) {
public function calculateBatchLimit(array $context) {
// TODO Maybe we need some other more sophisticated logic here?
return ceil($context['sandbox']['total'] / 100);
}
......
......@@ -17,6 +17,9 @@ use Drupal\migrate\Event\MigrateMapDeleteEvent;
use Drupal\migrate\Event\MigrateImportEvent;
use Drupal\migrate_plus\Event\MigratePrepareRowEvent;
/**
* Defines a migrate executable class for drush.
*/
class MigrateExecutable extends MigrateExecutableBase {
/**
......@@ -40,8 +43,9 @@ class MigrateExecutable extends MigrateExecutableBase {
protected $deleteCounter = 0;
/**
* Maximum number of items to process in this migration. 0 indicates no limit
* is to be applied.
* Maximum number of items to process in this migration.
*
* 0 indicates no limit is to be applied.
*
* @var int
*/
......@@ -63,6 +67,7 @@ class MigrateExecutable extends MigrateExecutableBase {
/**
* Count of number of items processed so far in this migration.
*
* @var int
*/
protected $counter = 0;
......@@ -149,6 +154,7 @@ class MigrateExecutable extends MigrateExecutableBase {
* Return the number of items created.
*
* @return int
* The number of items created.
*/
public function getCreatedCount() {
return $this->saveCounters[MigrateIdMapInterface::STATUS_IMPORTED];
......@@ -158,6 +164,7 @@ class MigrateExecutable extends MigrateExecutableBase {
* Return the number of items updated.
*
* @return int
* The updated count.
*/
public function getUpdatedCount() {
return $this->saveCounters[MigrateIdMapInterface::STATUS_NEEDS_UPDATE];
......@@ -167,6 +174,7 @@ class MigrateExecutable extends MigrateExecutableBase {
* Return the number of items ignored.
*
* @return int
* The ignored count.
*/
public function getIgnoredCount() {
return $this->saveCounters[MigrateIdMapInterface::STATUS_IGNORED];
......@@ -176,17 +184,20 @@ class MigrateExecutable extends MigrateExecutableBase {
* Return the number of items that failed.
*
* @return int
* The failed count.
*/
public function getFailedCount() {
return $this->saveCounters[MigrateIdMapInterface::STATUS_FAILED];
}
/**
* Return the total number of items processed. Note that STATUS_NEEDS_UPDATE
* is not counted, since this is typically set on stubs created as side
* effects, not on the primary item being imported.
* Return the total number of items processed.
*
* Note that STATUS_NEEDS_UPDATE is not counted, since this is typically set
* on stubs created as side effects, not on the primary item being imported.
*
* @return int
* The processed count.
*/
public function getProcessedCount() {
return $this->saveCounters[MigrateIdMapInterface::STATUS_IMPORTED] +
......@@ -199,6 +210,7 @@ class MigrateExecutable extends MigrateExecutableBase {
* Return the number of items rolled back.
*
* @return int
* The rollback count.
*/
public function getRollbackCount() {
return $this->deleteCounter;
......@@ -237,10 +249,12 @@ class MigrateExecutable extends MigrateExecutableBase {
}
/**
* Emit information on what we've done since the last feedback (or the
* beginning of this migration).
* Emit information on what we've done.
*
* Either since the last feedback or the beginning of this migration.
*
* @param bool $done
* TRUE if this is the last items to process. Otherwise FALSE.
*/
protected function progressMessage($done = TRUE) {
$processed = $this->getProcessedCount();
......@@ -254,12 +268,15 @@ class MigrateExecutable extends MigrateExecutableBase {
}
$this->message->display(\Drupal::translation()->formatPlural($processed,
$singular_message, $plural_message,
['@numitems' => $processed,
'@created' => $this->getCreatedCount(),
'@updated' => $this->getUpdatedCount(),
'@failures' => $this->getFailedCount(),
'@ignored' => $this->getIgnoredCount(),
'@name' => $this->migration->id()]));
[
'@numitems' => $processed,
'@created' => $this->getCreatedCount(),
'@updated' => $this->getUpdatedCount(),
'@failures' => $this->getFailedCount(),
'@ignored' => $this->getIgnoredCount(),
'@name' => $this->migration->id(),
]
));
}
/**
......@@ -274,10 +291,12 @@ class MigrateExecutable extends MigrateExecutableBase {
}
/**
* Emit information on what we've done since the last feedback (or the
* beginning of this migration).
* Emit information on what we've done.
*
* Either since the last feedback or the beginning of this migration.
*
* @param bool $done
* TRUE if this is the last items to rollback. Otherwise FALSE.
*/
protected function rollbackMessage($done = TRUE) {
$rolled_back = $this->getRollbackCount();
......@@ -290,9 +309,12 @@ class MigrateExecutable extends MigrateExecutableBase {
$plural_message = "Rolled back @numitems items - continuing with '@name'";
}
$this->message->display(\Drupal::translation()->formatPlural($rolled_back,
$singular_message, $plural_message,
['@numitems' => $rolled_back,
'@name' => $this->migration->id()]));
$singular_message, $plural_message,
[
'@numitems' => $rolled_back,
'@name' => $this->migration->id(),
]
));
}
/**
......@@ -335,9 +357,8 @@ class MigrateExecutable extends MigrateExecutableBase {
public function onPrepareRow(MigratePrepareRowEvent $event) {
if (!empty($this->idlist)) {
$row = $event->getRow();
/**
* @TODO replace for $source_id = $row->getSourceIdValues(); when https://www.drupal.org/node/2698023 is fixed
*/
// TODO: replace for $source_id = $row->getSourceIdValues();
// when https://www.drupal.org/node/2698023 is fixed.
$migration = $event->getMigration();
$source_id = array_merge(array_flip(array_keys($migration->getSourcePlugin()
->getIds())), $row->getSourceIdValues());
......