Good day to you, ladies and gentlemen,
I have a problem when trying to set relationships between two custom modules in SugarCRM Version 6.2.0RC1 (Build 6311)
Here is what my code looks like:
This works fine with one-to-many and one-to-one relationships, but I can not get it to work with many-to-many.PHP Code:protected function SOAPset_relationship($moduleName, $moduleEntryID, $linkFieldName, $IDArray) {
$res = $this->SOAPclient->set_relationship(
$this->sugarSession,
$moduleName,
$moduleEntryID,
$linkFieldName,
$IDArray
);
if ($res->created != 1) {
echo "SOAPset_relationship failed for: \n",
$moduleName, "\n",
$moduleEntryID, "\n",
$linkFieldName, "\n",
print_r($IDArray, true), "\n",
print_r($res, true), "\n";
}
return $res;
}
The relationships table has the following entries for my relationship:
I have tried to call my function with all the possible combinations:Code:id, relationship_name, lhs_module, lhs_table, lhs_key, rhs_module, rhs_table, rhs_key, join_table, join_key_lhs, join_key_rhs, relationship_type, relationship_role_column, relationship_role_column_value, reverse, deleted 'SOMELONGID', 'key_apples_key_worms', 'key_apples', 'key_apples', 'id', 'key_worms', 'key_worms', 'id', 'key_apples_key_worms_c', 'key_someweirdname1111111_ida', 'key_someweirdname222222_idb', 'many-to-many', '', '', 0, 0
but it always returns :PHP Code:$this->SOAPset_relationship('key_apples', $applesID, 'key_someweirdname1111111_ida', array($wormsID));
$this->SOAPset_relationship('key_apples', $applesID, 'key_someweirdname222222_idb', array($wormsID));
$this->SOAPset_relationship('key_worms', $wormsID, 'key_someweirdname1111111_ida', array($applesID));
$this->SOAPset_relationship('key_worms', $wormsID, 'key_someweirdname222222_ida', array($applesID));
I do not have much experience with SugarCRM, I would appreciate any help.Code:stdClass Object ( [created] => 0 [failed] => 1 [deleted] => 0 )


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks