public function MigrateExecutable::onPrepareRow in GatherContent 8.5
File
- src/
MigrateExecutable.php, line 81
Class
- MigrateExecutable
- Defines a migrate executable class.
Namespace
Drupal\gathercontentCode
public function onPrepareRow(MigratePrepareRowEvent $event) {
parent::onPrepareRow($event);
$row = $event
->getRow();
$migration = $event
->getMigration();
$sourceId = array_merge(array_flip(array_keys($migration
->getSourcePlugin()
->getIds())), $row
->getSourceIdValues());
if (!empty($this->importOptions[$sourceId['id']])) {
/** @var \Drupal\gathercontent\Import\ImportOptions $options */
$options = $this->importOptions[$sourceId['id']];
$destinationConfiguration = $migration
->getDestinationConfiguration();
$plugin = explode(':', $destinationConfiguration['plugin']);
$entityTypeManager = \Drupal::entityTypeManager();
$entityDefinition = $entityTypeManager
->getDefinition($plugin[1]);
if ($entityDefinition
->hasKey('published')) {
$statusKey = $entityDefinition
->getKey('published');
$row
->setDestinationProperty($statusKey, $options
->getPublish());
}
$row
->setDestinationProperty('gc_import_options/new_revision', $options
->getCreateNewRevision());
}
$sourceConfiguration = $migration
->getSourceConfiguration();
$this->latestGcStatus = $this->client
->projectStatusGet($sourceConfiguration['projectId'], $row
->getSourceProperty('statusId'));
}