File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -359,6 +359,11 @@ private function createUndefinedJoins($statement)
359359 // don't rewrite table from other databases
360360 foreach ($ this ->joins as $ join ) {
361361 if (strpos ($ join , '. ' ) !== false && strpos ($ statement , $ join ) === 0 ) {
362+ // rebuild the where statement
363+ if ($ separator !== null ) {
364+ $ statement = [$ separator , $ statement ];
365+ }
366+
362367 return $ statement ;
363368 }
364369 }
Original file line number Diff line number Diff line change @@ -206,9 +206,9 @@ public function testClauseWithRefBeforeJoin()
206206
207207 public function testFromOtherDB ()
208208 {
209- $ queryPrint = $ this ->fluent ->from ('db2.user ' )->order ('db2.user.name ' )->getQuery (false );
209+ $ queryPrint = $ this ->fluent ->from ('db2.user ' )->where ( ' db2.user.name ' , ' name ' )-> order ('db2.user.name ' )->getQuery (false );
210210
211- self ::assertEquals ('SELECT db2.user.* FROM db2.user ORDER BY db2.user.name ' , $ queryPrint );
211+ self ::assertEquals ('SELECT db2.user.* FROM db2.user WHERE db2.user.name = ? ORDER BY db2.user.name ' , $ queryPrint );
212212 }
213213
214214 public function testJoinTableWithUsing ()
You can’t perform that action at this time.
0 commit comments