Migrating node links

I am working on a project to migrate a website from asp.net to Drupal architecture. But the content of the site is very hierarchical and has many links between objects.

For example: each content belongs to a category, and each category belongs to a different section of the category. Now there may be another level of hierarchy.

I plan to use the migration module to migrate the contents of the database and link the migrated nodes using the node reference field.

But I am stuck with the Migrate module, as I cannot find a way to reconfigure the node link to the field anywhere ...

can someone help me with this ...

+3
source share
5 answers

, migrate. MySQL.

, , ( nodereference). ( nodereference ). , , mysql nodereference . .

, .

: * Drupal 6; Drupal 7 AFAIK. * MySQL.

. - .

+1

, , .. 2012 . , , . node node. , . werent, "" , nids . :

$query = Database::getConnection(
    'default', 'mysourcedb'
)->select(
    'mysourcetable','source'
)->fields('source', array(
        'id',
        'title',
        'whatever'
        'rel_rec_id'
    )
);

$query->leftJoin('migrate_map_relimport','relmap','relmap.sourceid1=source.rel_rec_id');
$query->addField('relmap','destid1','rel_node_id');

, "mysourcedb" "mysourcetable" , "rel_rec_id", RelImport, rel, rel_rec_id; ( ). , RelImport, , .

"migrate_map_relimport", , , drupal. , :

$this->map = new MigrateSQLMap(
    $this->machineName,
        array(
            'id' => array(
                'type' => 'int',
                'unsigned' => true,
                'not null' => true,
                'alias' => 'source' 
              )
        ),
        MigrateDestinationNode::getKeySchema(),
        'mysourcedb' // connection to use to write map tables
);

, , rel_node_id node:

$this->addFieldMapping( 'field_rel_node', 'rel_node_id' );

, .. YMMV

* -

+3

Content Migrate ( https://drupal.org/node/1144136). DK Content Construction Kit (CCK) D7 .

It will not do what you need out of the box, since you are coming from the ASP.net site instead of the D6 site, but it may provide some hints.

+1
source

Not what you ask, but it was useful to me: http://drupal.org/node/1013506

0
source

Source: https://habr.com/ru/post/1789677/


All Articles