I am Creating an Invoice and TRYING to create a Relationship in an After Save Action Hook. The relationship is a One to many form the Account -> The Invoice
This Code generates a PHP error -> Call to a member function add() on a non-object
$rel_name = 'account_aos_invoices';
$bean->load_relationship($rel_name);
$bean->$rel_name->add($invoice->id);
If I add a Custom Relationship using Studio, this works just fine
$rel_name = 'accounts_aos_invoices_1';
$bean->load_relationship($rel_name);
$bean->$rel_name->add($invoice->id);
account_aos_invoices is listed in Studio in the Account and Invoices Relationships, upon checking the relationships table in the database, I see it there as well. However, the join_table fields and keys are empty and the table account_aos_invoices does not exist in the database. Checking the relationships.cache.php in the cache Directory, I cannot see the relationship defined there either
I need to be able to add a relationship to the Account on a One to many basis so the Invocies display in a Sub Panel on the Account
How do I do this if I am usingthe wrong approach?
or
Is this a SuiteCRM bug, if so, how do I fix it
SuiteCRM Version 7.1.1
Sugar Version 6.5.16 (Build 1082)
Thanks and Regards
Mark Cupitt