protected function MigrateUpdater::processLanguages in GatherContent 8.5
1 call to MigrateUpdater::processLanguages()
- MigrateUpdater::processEntity in gathercontent_upload/
src/ Export/ MigrateUpdater.php
File
- gathercontent_upload/
src/ Export/ MigrateUpdater.php, line 123
Class
- MigrateUpdater
- Class for handling import/update logic from GatherContent to Drupal.
Namespace
Drupal\gathercontent_upload\ExportCode
protected function processLanguages(MigrationInterface $migration, EntityInterface $entity, Row $row, array $destinationIds) {
$idMap = $migration
->getIdMap();
$languages = $entity
->getTranslationLanguages();
$sourceId = $row
->getSourceIdValues();
$sourceId = $sourceId['id'];
foreach ($languages as $language) {
$result = $this->database
->select('gathercontent_entity_mapping')
->fields('gathercontent_entity_mapping', [
'entity_id',
'entity_type',
])
->condition('entity_id', $entity
->id())
->condition('entity_type', $entity
->getEntityTypeId())
->condition('langcode', $language
->getId())
->execute()
->fetchAll();
if (empty($result)) {
$this->database
->insert('gathercontent_entity_mapping')
->fields([
'entity_id' => $entity
->id(),
'entity_type' => $entity
->getEntityTypeId(),
'gc_id' => $sourceId,
'migration_id' => $migration
->id(),
'langcode' => $language
->getId(),
])
->execute();
}
if ($language
->isDefault()) {
continue;
}
$destinationIds[] = $language
->getId();
$idMap
->saveIdMapping($row, $destinationIds);
}
}