@@ -161,6 +161,8 @@ protected function buildCriteria(array $statements, bool $bindValues = true): ar
161161 if (is_string ($ key ) && $ this ->aliasPrefix !== null && strpos ($ key , '. ' ) === false ) {
162162 $ key = $ this ->aliasPrefix . '. ' . $ key ;
163163 }
164+ } else {
165+ $ bindings [] = $ key ->getBindings ();
164166 }
165167
166168 $ value = $ statement ['value ' ];
@@ -239,7 +241,6 @@ protected function buildCriteria(array $statements, bool $bindValues = true): ar
239241 }
240242
241243 $ criteria [] = $ key ;
242- $ bindings [] = $ key ->getBindings ();
243244 continue ;
244245
245246 }
@@ -303,6 +304,8 @@ protected function buildJoin(array $statements, array &$bindings): string
303304 {
304305 $ sql = '' ;
305306
307+ $ newBindings = [];
308+
306309 if (isset ($ statements ['joins ' ]) === false ) {
307310 return $ sql ;
308311 }
@@ -323,7 +326,7 @@ protected function buildJoin(array $statements, array &$bindings): string
323326 if ($ joinBuilder instanceof QueryBuilderHandler) {
324327 $ valueQuery = $ joinBuilder ->getQuery ('criteriaOnly ' , false );
325328 $ valueSql = $ valueQuery ->getSql ();
326- $ bindings + = $ valueQuery ->getBindings ();
329+ $ newBindings [] = $ valueQuery ->getBindings ();
327330 }
328331
329332 $ sqlArr = [
@@ -337,6 +340,8 @@ protected function buildJoin(array $statements, array &$bindings): string
337340 $ sql = $ this ->concatenateQuery ($ sqlArr );
338341 }
339342
343+ $ bindings = array_merge ($ bindings , ...$ newBindings );
344+
340345 return $ sql ;
341346 }
342347
0 commit comments