3
如果表中有複合主鍵,我們如何實例化MigrateSQLMap?如何在組合密鑰場景中構建MigrateSQLMap
如果表中有複合主鍵,我們如何實例化MigrateSQLMap?如何在組合密鑰場景中構建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(
'vendor_code' => array(
'type' => 'varchar',
'length' => 250,
'not null' => TRUE,
),
'client_code' => array(
'type' => 'varchar',
'length' => 250,
'not null' => TRUE,
),
),
MigrateDestinationEntityAPI::getKeySchema('vendor')
);
在上面的代碼,* vendor_code *和* client_code *是複合鍵的組分。
對此有何幫助? – mishka