Multiple 'where' params in getBeans() of Link2

Hello,
I have the following code with the goal to retrieve, from a ProspectList all accounts that has no email sent in the current month:

 $accounts_bean = BeanFactory::getBean('ProspectLists','$id_ProspectLists')->get_linked_beans('accounts', 'Account');
  foreach($accounts_bean as $account){
   $account->load_relationship('emails');
   $emails = $account->emails->getBeans(array(
        'where' => array(
          'lhs_field' => 'type',
          'operator' => '=',
          'rhs_value' => 'out'
        ),
        'and' => array(
          array(
           'lhs_field' => 'status',
           'operator' => '=',
           'rhs_value' => 'sent'
          ),
          array(
           'lhs_field' => 'MONTH(date_sent_received)',
           'operator' => '<>',
           'rhs_value' => 'MONTH(CURRENT_TIMESTAMP)'
          )
        )
        ));
  }

As per topic title, how can I pass multiple where params to getBeans() function, if it pretends only one array like the following?

array(
        'where' => array(
          'lhs_field' => 'type',
          'operator' => '=',
          'rhs_value' => 'out'
        )
)

Am I misunderstanding something or the function can filters on only one field?
Any helps are appreciated. Thank you.

Hi

You can not pass multiple Where Condition in getBean() function. It’s the Default function of the SuiteCRM & allows only one Where Condition. If we modify it then it’ll affect other places as well.
You can achieve your requirement by following code,

<?php
$currentTime = date('Y-m-d H:i');
$accounts_bean = BeanFactory::getBean('ProspectLists','$id_ProspectLists')->get_linked_beans('accounts', 'Account');
foreach($accounts_bean as $account){
	$account->load_relationship('emails');
	$emails = $account->emails->get();
 
	$flag = 0;
	foreach ($emails as $key => $value) {
		$subpanelModuleBean = BeanFactory::getBean('Emails', $value);
		$currentMonth = date('m', strtotime($currentTime));
		$month = date('m', strtotime($subpanelModuleBean->date_sent_received));
		if($subpanelModuleBean->type == 'out' && ($subpanelModuleBean->status != 'sent' && $currentMonth <> $month)){
				$flag = 1;
			}
	}
 
	$accountIds = array();
	if($flag == 1){
		$accountIds[] = $account->id;
	}
}

See Screenshot : http://prntscr.com/116eip8