File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ public function where(WhereCondition|array|WhereGroup $where): static
8383 */
8484 public function getWhere (): WhereGroup |null
8585 {
86- if ($ this ->where ) {
86+ if ($ this ->where && $ this -> where -> count () > 0 ) {
8787 return $ this ->where ;
8888 }
8989
@@ -192,4 +192,4 @@ public function getLimit(): ?Limit
192192 {
193193 return $ this ->limit ;
194194 }
195- }
195+ }
Original file line number Diff line number Diff line change @@ -30,6 +30,16 @@ public function testSelect()
3030 $ this ->assertEquals ("SELECT * FROM `test` " , $ this ->sql ->generate ($ query ));
3131 }
3232
33+ public function testSelectEmptyWhere ()
34+ {
35+ $ query = new SelectQuery (
36+ new WhereGroup (),
37+ );
38+ $ query ->modelClassName = TestModel::class;
39+
40+ $ this ->assertEquals ("SELECT * FROM `test` " , $ this ->sql ->generate ($ query ));
41+ }
42+
3343 public function testSelectWhereCondition ()
3444 {
3545 $ query = new SelectQuery (
You can’t perform that action at this time.
0 commit comments