Drupal 7 如何在复合密钥场景中构造MigrateSQLMap
如果表具有复合主键,我们如何实例化MigrateSQLMap?由于MigrateSQLMap采用数组,您可以在源定义中设置多个字段:Drupal 7 如何在复合密钥场景中构造MigrateSQLMap,drupal-7,migrate,Drupal 7,Migrate,如果表具有复合主键,我们如何实例化MigrateSQLMap?由于MigrateSQLMap采用数组,您可以在源定义中设置多个字段: // The source ID here is the one retrieved from each data item in the XML file, and // used to identify specific items $this->map = new MigrateSQLMap($this->machineName, array
// The source ID here is the one retrieved from each data item in the XML file, and
// used to identify specific items
$this->map = new MigrateSQLMap($this->machineName,
array(
'vendor_code' => array(
'type' => 'varchar',
'length' => 250,
'not null' => TRUE,
),
'client_code' => array(
'type' => 'varchar',
'length' => 250,
'not null' => TRUE,
),
),
MigrateDestinationEntityAPI::getKeySchema('vendor')
);
在上面的代码中,*供应商代码*和*客户代码*是复合密钥的组件