我正在尝试为d7-d8迁移编写一个自定义源代码插件。我想要扩展Drupal\node\ plugin \ Node.php \d7 Node.php插件。
当我试图从UI运行迁移时,我得到了以下错误:
迁移my_node_page不符合要求。在源站点中未启用模块my_xtra。source_module: my_xtra.
当我运行drush ms时,会得到一个不同的错误。
没有为源插件变量配置数据库连接
数据库连接键在组yml中指定,用于其他不使用自定义源插件的迁移。
这是我的yml文件
id: my_node_page
label: Node Basic Page
audit: true
migration_tags:
- Drupal 7
- Content
migration_group: my_group
source:
plugin: my_xtra_node
node_type: 'page'
process:这是我的定制插件。
select('node_revision', 'nr')
->fields('n', [
'nid',
'type',
'language',
'status',
'created',
'changed',
'comment',
'promote',
'sticky',
'tnid',
'translate',
])
->fields('nr', [
'vid',
'title',
'log',
'timestamp',
]);
$query->addField('n', 'uid', 'node_uid');
$query->addField('nr', 'uid', 'revision_uid');
$query->innerJoin('node', 'n', static::JOIN);
// If the content_translation module is enabled, get the source langcode
// to fill the content_translation_source field.
if ($this->moduleHandler->moduleExists('content_translation')) {
$query->leftJoin('node', 'nt', 'n.tnid = nt.nid');
$query->addField('nt', 'language', 'source_langcode');
}
$this->handleTranslations($query);
if (isset($this->configuration['node_type'])) {
$query->condition('n.type', $this->configuration['node_type']);
}
return $query;
}
}谢谢!
发布于 2021-04-30 18:15:07
您的源模块应该是“节点”,因为这就是您要扩展的内容。
/**
* Drupal 7 node source from database.
*
* @MigrateSource(
* id = "my_xtra_node",
* source_module = "node"
* )
*/https://drupal.stackexchange.com/questions/294670
复制相似问题