getSourceProperty('language'); if (!$language) { throw new MigrateException('No language found.'); } $object_id = $row->getSourceProperty($object_id_name); if (!$object_id) { throw new MigrateException('No objectid found.'); } // If this row has been migrated it is a duplicate so skip it. if ($id_map->lookupDestinationIds([$object_id_name => $object_id, 'language' => $language])) { return FALSE; } // Save the translation for the property already in the row. $property_in_row = $row->getSourceProperty('property'); $row->setSourceProperty($property_in_row . '_translated', $row->getSourceProperty('translation')); // Get the translation, if one exists, for the property not already in the // row. $query = $this->select($this->i18nStringTable, 'i18n') ->fields('i18n', ['lid']) ->condition('i18n.property', $property_not_in_row) ->condition('i18n.objectid', $object_id); $query->leftJoin('locales_target', 'lt', 'i18n.lid = lt.lid'); $query->condition('lt.language', $language); $query->addField('lt', 'translation'); $results = $query->execute()->fetchAssoc(); if (!$results) { $row->setSourceProperty($property_not_in_row . '_translated', NULL); } else { $row->setSourceProperty($property_not_in_row . '_translated', $results['translation']); } return TRUE; } }