getBeans function is not work in load relationship

Hi Guys,

Recently we have upgrade SuiteCRM from SuiteCRM 7.6.3 to SuiteCRM 7.11.12 even we have upgrade the PHP to 7.2 after upgrade many custom code functionalities are not working mainly the load_relationship->rel_name->getBeans(); Activity but other load function load_relationship->rel_name->get(); is working fine returning all the ids of the related records. even custom logic hooks are showing error but it got fixed by adding “=NULL” in each logic hook function.
eg: function update_kit($bean=null,$event=null,$arguments=null).

There is no error logs in the system even no error reporting on the screen, no error in browser console just a pain white screen.

can anyone point what exactly getting wrong.

" $academic->load_relationship(‘aak_subscriptions_aak_academics’);
$academic->aak_subscriptions_aak_academics->getBeans();"

Try some more options from Admin / Repairs

  • QR&R
  • Rebuild relationships (this is the one you lilkely need)
  • anything Javascript related

Tried all those options even i check with the core file it is failing at getBeans function in /data/link2.php line number 480 . When i manually check with loop count for 20 to 30 its loading but when i load 100 records, 200 records it is failing.

        if (is_array($rows) || is_object($rows)) {				
            foreach ((array)$rows as $id => $vals) {
                if (empty($this->beans[$id])) {
                    //at this point it is failing
			$tmpBean =BeanFactory::getBean($rel_module, $id);
                  // end
                    if ($tmpBean !== false) {
                        $result[$id] = $tmpBean;
                    }
                } else {
                    $result[$id] = $this->beans[$id];
                }
            }
			
        }

Have a look at your PHP resource limits, then. Im php.ini you define

  • memory_limit
  • max_execution_time
  • max_upload_size
  • post_max_size

All these typically need increases; the first two I believe could be causing your problem.

Restart web server after making changes; and check in Admin / Diagnostics / phpinfo if your values are taking effect (people often mistakingly edit the wrong php.ini, so this check is important).

@pgr I already enhance the limits in php.ini the values set as below:
memory_limit = 512M
max_execution_time=300
post_max_size= 512M
upload_max_filesize=200M

But i dont have any option with “max_upload_size” After doing all these investigation i posted the issue in the forum

And I am facing one more issue with logic hooks as my present system is highly customized system every custom logic hooks are showing error. But it got fixed by adding “=NULL” in each logic hook function. Why is it so

eg: function update_kit($bean=null,$event=null,$arguments=null).

Yes that :point_up: is the correct name for it, I was mistaken

I don’t know why you had the problem with the logic hooks, I don’t think there was a change in the function definitions, it’s probably this version of PHP which is more strict about the match required between the function definition and the function call.

You should keep an eye on your PHP log, the one defined in error.log in your php.ini, since that’s where you see those messages. Usually a simple web search will take you to the correct solution.

Hello. Were you able to determine your problem because I think that I am experiencing this same issue.
I too upgraded my SuiteCRM (from 7.8.31 to 7.12.7 and PHP from 5.5 to 7.3) and my custom code that uses load_relationship is experiencing problems. I have stepped through the code and load_relationship seems to be working correctly because it creates the Link2 object and returns success. But when I try to use the link object that it created for a later function call, I am getting a blank screen in the CRM, a 500 Internal Server Error in the console log and this error in my apache error log…PHP Fatal error: Uncaught Error: Call to a member function getJoin() on null.

$accountObject->load_relationship(“opportunities”);
$accountObject->opportunities->getJoin($params); <<<<Error occurs here and when I look at $accountObject->opportunities in the debugger, it is null.

I am still able to debug my 7.8.31 instance and all works without issue. The code that calls load_relationship and getJoin has not changed.

I have checked my PHP resource limits and verified file protections, repair/rebuild, etc.

Any help would be greatly appreciated.
Dianna