|
1
|
|
|
<?php |
|
2
|
|
|
class Lib_Test_Enterprise_MergeTest extends Lib_Test_TestAbstractEnterprise |
|
3
|
|
|
{ |
|
4
|
|
|
public function getTestName() |
|
5
|
|
|
{ |
|
6
|
|
|
return 'Merge'; |
|
7
|
|
|
} |
|
8
|
|
|
|
|
9
|
|
|
protected function _run() |
|
10
|
|
|
{ |
|
11
|
|
|
$sObject = new stdclass(); |
|
12
|
|
|
$sObject->LastName = 'Tran'; |
|
13
|
|
|
$sObject->BirthDate = '1927-01-25'; |
|
14
|
|
|
$sObject->Phone = '510-555-5555'; |
|
15
|
|
|
|
|
16
|
|
|
$sObject2 = new stdclass(); |
|
17
|
|
|
$sObject2->LastName = 'Tran'; |
|
18
|
|
|
$sObject2->BirthDate = '1957-01-25'; |
|
19
|
|
|
$sObject2->Phone = '510-486-9969'; |
|
20
|
|
|
|
|
21
|
|
|
$sObject3 = new stdclass(); |
|
22
|
|
|
$sObject3->LastName = 'Tran'; |
|
23
|
|
|
$sObject3->BirthDate = '1957-01-25'; |
|
24
|
|
|
|
|
25
|
|
|
echo "Create 3 contacts.\n"; |
|
26
|
|
|
|
|
27
|
|
|
$createResponse = $this->_mySforceConnection->create(array($sObject, $sObject2, $sObject3), 'Contact'); |
|
28
|
|
|
|
|
29
|
|
|
print_r($createResponse); |
|
30
|
|
|
|
|
31
|
|
|
// Merge $sObject2 into $sObject |
|
32
|
|
|
$mergeRequest = new stdclass(); |
|
33
|
|
|
$sObject->Id = $createResponse[0]->id; |
|
34
|
|
|
$mergeRequest->masterRecord = $sObject; |
|
35
|
|
|
$mergeRequest->comments = 'My merge comments'; |
|
36
|
|
|
|
|
37
|
|
|
echo "Merge second and third contacts into the first contact.\n"; |
|
38
|
|
|
|
|
39
|
|
|
$mergeRequest->recordToMergeIds = array($createResponse[1]->id, $createResponse[2]->id); |
|
40
|
|
|
|
|
41
|
|
|
$mergeResponse = $this->_mySforceConnection->merge($mergeRequest, 'Contact'); |
|
42
|
|
|
|
|
43
|
|
|
print_r($mergeResponse); |
|
44
|
|
|
} |
|
45
|
|
|
} |