首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在源站点错误中未启用自定义迁移源插件

在源站点错误中未启用自定义迁移源插件
EN

Drupal用户
提问于 2020-06-19 13:52:27
回答 1查看 1.2K关注 0票数 0

我正在尝试为d7-d8迁移编写一个自定义源代码插件。我想要扩展Drupal\node\ plugin \ Node.php \d7 Node.php插件。

当我试图从UI运行迁移时,我得到了以下错误:

迁移my_node_page不符合要求。在源站点中未启用模块my_xtra。source_module: my_xtra.

当我运行drush ms时,会得到一个不同的错误。

没有为源插件变量配置数据库连接

数据库连接键在组yml中指定,用于其他不使用自定义源插件的迁移。

这是我的yml文件

代码语言:javascript
复制
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:

这是我的定制插件。

代码语言:javascript
复制
    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;
      } 
}

谢谢!

EN

回答 1

Drupal用户

发布于 2021-04-30 18:15:07

您的源模块应该是“节点”,因为这就是您要扩展的内容。

代码语言:javascript
复制
/**
* Drupal 7 node source from database.
*
* @MigrateSource(
*   id = "my_xtra_node",
*   source_module = "node" 
* )
*/
票数 0
EN
页面原文内容由Drupal提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://drupal.stackexchange.com/questions/294670

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档