class JSONMigration extends Migration { /**
- A constructor */ public function __construct() {
class JSONMigration extends Migration {
/**
* A constructor
*/
public function __construct() {
parent::__construct(MigrateGroup::getInstance('json_migration'));
$http_options = array();
// define source definitions.... wont work with out this so hey ho
$this->map = new MigrateSQLMap(
$this->machineName,
array(
'jobref' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
),
MigrateDestinationNode::getKeySchema()
);
$fields = array(
'jobref' => 'Job reference',
'jobTitle' => 'Job title',
'aboutOurClient' => 'About the job',
);
$json_folder = DRUPAL_ROOT . '/' . drupal_get_path('module', 'json_migration') . '/';
$items_url = $json_folder . 'PEsamplejson.json';
$this->source = new MigrateSourceList(new ExampleListJSON($items_url),
new ExampleItemJSON($items_url, array()), $fields);
$options = array();
$options = array('track_changes' => 1);
$this->destination = new MigrateDestinationNode('jsontest', $options);
//$this->systemOfRecord = Migration::DESTINATION;
$this->addFieldMapping('field_jobref', 'jobref');
$this->addFieldMapping('title' , 'jobTitle');
$this->addFieldMapping('body' , 'aboutOurClient');
}
public function prepareRow($row) {
// i can remap/manipulate here if needs be ie date
}
}
}
public function prepareRow($row) { // i can remap/manipulate here if needs be ie date }
}