Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- codeon_migrate.info
- -----------------------------
- name = CodeOn Migrate
- description = CodeOn Test Data Migration
- core = 7.x
- package = CodeOn
- version = 7.x-1.0
- project = codeon_migrate
- dependencies[] = migrate
- files[] = migrate_codeon.migrate.inc
- files[] = testimonials.inc
- migrate_codeon.migrate.inc
- -------------------------------
- /**
- * Implements hook_migrate_api().
- */
- function migrate_codeon_migrate_api() {
- $api = array(
- 'api' => 2,
- 'groups' => array(
- 'CodeOn' => array(
- 'title' => t('CodeOn Test Data Migrations'),
- ),
- ),
- 'migrations' => array(
- 'CodeOnTestimonials' => array(
- 'class_name' => 'TestimonialsMigration',
- 'group_name' => 'CodeOn',
- ),
- ),
- );
- return $api;
- }
- testimonials.inc
- -------------------------------
- class TestimonialsMigration extends Migration {
- public function __construct($arguments) {
- parent::__construct($arguments);
- $query = Database::getConnection('default', 'legacy')
- ->select('example_pages')
- ->fields('example_pages', array('pgid', 'page_title', 'page_body'));
- $this->source = new MigrateSourceSQL($query);
- $this->destination = new MigrateDestinationNode('page');
- $this->map = new MigrateSQLMap($this->machineName,
- array(
- 'pgid' => array('type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- )
- ),
- MigrateDestinationNode::getKeySchema()
- );
- $this->addFieldMapping('title', 'page_title');
- $this->addFieldMapping('body', 'page_body');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement