@@ -328,7 +328,7 @@ function isUnary ($op) {
328
328
return false ;
329
329
}
330
330
331
- function query ($ body , &$ params , &$ count ) {
331
+ function query ($ body , &$ params , &$ count, $ up_relation = null ) {
332
332
if ($ params === null ) { $ params = []; }
333
333
if ($ count === null ) { $ count = 0 ; }
334
334
$ predicats = [];
@@ -345,7 +345,7 @@ function query ($body, &$params, &$count) {
345
345
break ;
346
346
}
347
347
348
- $ predicats [] = '( ' . $ this ->query ($ value , $ params , $ count ) . ' ) ' ;
348
+ $ predicats [] = '( ' . $ this ->query ($ value , $ params , $ count, $ relation ) . ' ) ' ;
349
349
} else {
350
350
if (!is_array ($ value )) {
351
351
if ($ this ->isUnary ($ value )) {
@@ -441,6 +441,9 @@ function query ($body, &$params, &$count) {
441
441
$ predicats [] = $ predicat ;
442
442
}
443
443
}
444
+ if ($ up_relation ) {
445
+ $ relation = $ up_relation ;
446
+ }
444
447
return join ($ relation , $ predicats );
445
448
}
446
449
@@ -692,7 +695,7 @@ function search($body, $options) {
692
695
$ params = [];
693
696
$ count = 0 ;
694
697
695
- $ statement .= ' WHERE ' . $ this ->query ($ body , $ params , $ count );
698
+ $ statement .= ' WHERE ' . $ this ->query ($ body , $ params , $ count );
696
699
if (! empty ($ options ['sort ' ])) {
697
700
$ statement .= ' ' . $ this ->prepareSort ($ options ['sort ' ]);
698
701
}
0 commit comments