Example:

form:

class ExampleMigration extends Migration {
  public function settingsForm() {
    $form['section'] = array(
      '#title' => 'Section',
      '#type' => 'select',
      '#options' = array(1 => 'Section 1', 2 => 'Section 2');
      '#default_value' => 1,
    );
    return $form;
  }
  ...
}

ui:

ui

or http://imageshack.us/photo/my-images/18/migrate2.jpg/

use in code:

class ExampleMigration extends Migration {
  public function __construct() {
    parent::__construct();
    $query = db_select('threads');
    $query->condition('section', $this->getSetting('section'));
    $this->source = new MigrateSourceSQL($query);
    ...
  }
  ...
}
CommentFileSizeAuthor
migrate1.jpg210.18 KBxandeadx

Comments

xandeadx’s picture

Issue summary: View changes

add image

xandeadx’s picture

Issue summary: View changes

fix image

tenken’s picture

I would love to see something like this as well, and can maybe use the example code here to my own ends to parameterize a migrate task.

I have a University Campus webservice I need to call with a department listing and quarter identifier to get XML enrollment data for a UC campus.

I am using Migrate already to move data from 1 db to another db ... so I'd love to stick with Migrate moving data around as much as possible (instead of also using Feeds).

In this case I'd love to make the webservice call to fetch the XML data into file(s) into a Migration Task that is a dependancy for other Tasks. But I need to parameterize the webservice call to fetch the XML data. A subsequent Migration task could then read any xml files saved from this 1st task and migrate the data into database tables.

So any "official" support for additional UI controls for passing parameters into tasks either via drush command or the migrate UI. If I do go down this route would an additional Wiki FAQ entry be useful for others ... ?

I am basically looking to implement exactly the screenshot -- although since i'm calling a webservice the task calling the webservice would not know item counts at all (it would just fetch data for X department(s) on Y quarter_id).

tenken’s picture

Issue summary: View changes

add image

pifagor’s picture

Issue summary: View changes
Status: Active » Closed (outdated)