I'm new in drupal and I try to migrate the article of an old blog with sql database to my drupal 9 project. I follow the instruction give by the drupal API migration docs, so i connect the 2 database in the settings.php. Then i generate a module with drush call article_migration the file migrate_plus.migration.article.yml :
#Migration metadata
id: article
label: migrate list of articles
migration_group: article_migration
#Source plugin, id defined in the @MigrateSource annotation
#in the src/Plugin/migrate/source/Article.php file.
source:
plugin: article
#Destination plugin
destination:
plugin: entity:node
#Process plugin
process:
# Node type (bundle)
type:
plugin: default_value
default_value: article
# One-to-one field mapping using the default "get" process plugin.
title: title
body/value: content
#Nothing needed here, it is a single table without any other relation.
migration_dependencies: {}
plugin source article.php follow the norme :
/**
* @file
* Contains Drupal\article_migration\Plugin\migrate\source\Article
*/
namespace Drupal\article_migration\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
/**
* Source plugin for Articles
*
*@MigrateSource(
* id = "news"
*)
*/
class Article extends SqlBase {
/**
* {@inheritDoc}
*/
public function query(){
$query = $this->select('news', 'n')
->fields('n', array(
'id',
'title',
'content',
));
return $query;
}
/**
* {@inheritDoc}
*/
public function fields(){
$fields = array(
'id' => $this->t('Autoincrement ID'),
'title' => $this->t('Article name'),
'content' => $this->t('HTML content'),
);
return $fields;
}
/**
* {@inheritDoc}
*/
public function getIDs(){
return [
'id' => [
'type' => 'integer',
'alias' => 'n',
],
];
}
}
and yet when i try to execute the migration i have that message error that i don't understand saying that my plugin article doesn't exist :
The "article" plugin does not exist. Valid plugin IDs for Drupal\migrate\Plugin\MigrateSourcePluginManager are: news, d7_block_translation, d6_block_translation, block, d7_block_custom_translation, d7_block_custom, d6_box, d6_box_tra
nslation, d7_color, d7_comment_entity_translation, d7_comment, d6_comment, contact_category, contact_settings, d7_view_mode, d7_field_instance_per_view_mode, d7_field_instance_per_form_display, d7_field_option_translation, d7_field,
if someone can put lead me to the right direction or tell me what i'am missing
/** @MigrateSource( id="...") */
Your source plugin isnews
, notarticle
– Hudri Jul 28 '20 at 14:35