How to use different metadata_name_value_pairs_operator for different metadata_name_value_pairs combinations?

While using elgg_get_entities_from_metadata() function to retrieve entities having a particular set of metadata name-value combinations, I have encountered a situation in which I have to use certain metadatas conditions(name-value pairs) with OR operator, ANDed with some more metadata name-value pairs. But since the syntax states that we use the two properties metadata_name_value_pairs and operator separately, I cant see a way to impose such condition.

$return = array();
$options =     array(
    'type' => 'user',
    'metadata_name_value_pairs' => array(

    array('name'=>'Name1','value'=>'Value1','operand'=>'='),

    array('name'=>'Name2', 'value'=>'Value2',operand=>'='),

    array('name'=>'Name3', 'value'=>'Value3',operand=>'=')),

    'metadata_name_value_pairs_operator'=>'OR', /* How to use this operator for 1st two name value pairs and ANDed with 3rd name value pair*/
    'limit'=>$limit,
    'offset'=>$offset,
    'count'=>$count,
    );
    $return = elgg_get_entities_from_metadata($options);
    

Please let me know, if there is some other way to do the same thing but with more control.

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking