AnsweredAssumed Answered

Migrating 6.5 to 7.9 - Bean->save() doesn't save relationships

Question asked by Adriano Micci on Sep 25, 2017
Latest reply on Sep 26, 2017 by Francesca Shiekh

Hi all,

I got another issue after upgrading sugar from 6.5 to 7.9.

A bunch of code to exlpain the problem:

$answerBean = BeanFactory::newBean("ict4CMSAnswers");
$answerBean->name = $questionBean->name;
$answerBean->description = "Risposta a '" . $questionBean->name . " di " . $contactBean->first_name . " " .
$answerBean->campaign_id = $campaign_id;
$answerBean->question_id = $question_id;
$answerBean->contacts_id = $contacts_id;
$answerBean->answer = $value;
$answerBean->team_id = 1;
$answerBean->team_set_id = 1;

I have a module named ict4CMSAnswer related to Campaigns and Contacts.

So in database I got these tables

  • ict4cmsanswers
  • contacts_ict4cmsanswers
  • campaigns_ict4cmsanswers

In 6.5 when I run code above sugar create a record in ict4cmsanswers, a record in contacts_ict4cmsanwers and a record in campaigns_ict4cmsanswers.

Table contacts_ict4cmsanswers contains anwer_id and contact_id.

Table campaigns_ict4cmsanswers contains answer_id and campaign_id.

In 7.9 records in contacts_ict4cmsanswers and campaigns_ict4cmsanswers are created but empty.

For example in contacts_ict4cmsanswers I got a record with contact_id = NULL and answer_id = NULL.

Did I forgot something?


Thank you.