Hello,
I'm just starting to learn Drupal and the first thing I'm trying to do is import some data using the Mirgrate module.
I've been reading what I've been able to find on it and I've been able to import data using the table wizard and then import that data into my content nodes, it all works well.
What I'm having a problem with is trying to understand how to use the hooks to do other things. For example I'm importing a bunch of articles, for each article that I'm importing I want to be able to create a user account for the author (if it doesn't exist) and import 0 to many comments for that 1 article.
I'm been reading about the hooks, but I just don't get how it works and how it ties in with the mirgrate process. I can't even seen to figure out where to begin.
I wanted to just do something simple like print out a field from each row that I'm importing, just to see how it works. So I created a module and enabled it, in the module I just did something simple
<?php
/**
* Implementation of hook_migrate_init().
* parameters: none
* return: none
*/
function DataImport_migrate_destination_prepare_user(&$user, $tblinfo, $row) {
// do something the first time migrate_invoke_all() is called.
echo $row['StoryId'];
}
When I did the migrate I didn't get anything (which doesn't surprise me).
Could someone give me some sort of example of how I go about hooking my own code into the migrate process?
TIA!