public function MerciLineItemMigration::__construct in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3
General initialization of a Migration object.
Overrides Migration::__construct
File
- merci_migrate/
merci_line_item.inc, line 4
Class
Code
public function __construct($arguments) {
parent::__construct($arguments);
$query = db_select('merci_reservation_detail', 'mrd')
->fields('mrd');
$query
->join('node', 'n', 'n.nid = mrd.merci_item_nid');
$query
->join('merci_reservation_old', 'mrs', 'mrs.nid = mrd.nid');
$query
->join('field_data_field_merci_date', 'fdfmd', "mrd.nid = fdfmd.entity_id AND entity_type = 'node'");
$query
->fields('n')
->fields('mrs')
->fields('fdfmd');
$this->source = new MigrateSourceSQL($query);
$this->dependencies = array(
'MerciItem',
'MerciItemDisplay',
);
$this->destination = new MigrateDestinationLineItem('merci_line_item');
$this->map = new MigrateSQLMap($this->machineName, array(
'merci_item_nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'alias' => 'mrd',
),
), MigrateDestinationLineItem::getKeySchema());
$this
->addFieldMapping('merci_checkout_dates', 'field_merci_date_value');
$this
->addFieldMapping('merci_checkout_dates:to', 'field_merci_date_value2');
$this
->addFieldMapping('merci_reservation_status', 'merci_checkout_status');
$this
->addFieldMapping('quantity')
->defaultValue(1);
$this
->addFieldMapping('merci_resource_reference', 'merci_item_nid')
->sourceMigration('MerciItem');
$this
->addFieldMapping('line_item_label', 'title');
$this
->addFieldMapping('merci_checkout_status', 'merci_reservation_status');
//$this->addFieldMapping('merci_resource_display', 'resource_display_id');
$this
->addFieldMapping('entity_id', 'nid');
}