@@ -295,6 +295,13 @@ class BaseBuilder
295295 */
296296 protected $ pregOperators = [];
297297
298+ /**
299+ * Limit 0 as all
300+ *
301+ * @var bool
302+ */
303+ protected $ limitZeroAsAll ;
304+
298305 /**
299306 * Constructor
300307 *
@@ -334,6 +341,8 @@ public function __construct($tableName, ConnectionInterface $db, ?array $options
334341 }
335342 }
336343 }
344+
345+ $ this ->limitZeroAsAll = config (Feature::class)->limitZeroAsAll ?? true ; // @phpstan-ignore nullCoalesce.property
337346 }
338347
339348 /**
@@ -1511,8 +1520,7 @@ public function orderBy(string $orderBy, string $direction = '', ?bool $escape =
15111520 */
15121521 public function limit (?int $ value = null , ?int $ offset = 0 )
15131522 {
1514- $ limitZeroAsAll = config (Feature::class)->limitZeroAsAll ?? true ; // @phpstan-ignore nullCoalesce.property
1515- if ($ limitZeroAsAll && $ value === 0 ) {
1523+ if ($ this ->limitZeroAsAll && $ value === 0 ) {
15161524 $ value = null ;
15171525 }
15181526
@@ -1633,8 +1641,7 @@ protected function compileFinalQuery(string $sql): string
16331641 */
16341642 public function get (?int $ limit = null , int $ offset = 0 , bool $ reset = true )
16351643 {
1636- $ limitZeroAsAll = config (Feature::class)->limitZeroAsAll ?? true ; // @phpstan-ignore nullCoalesce.property
1637- if ($ limitZeroAsAll && $ limit === 0 ) {
1644+ if ($ this ->limitZeroAsAll && $ limit === 0 ) {
16381645 $ limit = null ;
16391646 }
16401647
@@ -1771,8 +1778,7 @@ public function getWhere($where = null, ?int $limit = null, ?int $offset = 0, bo
17711778 $ this ->where ($ where );
17721779 }
17731780
1774- $ limitZeroAsAll = config (Feature::class)->limitZeroAsAll ?? true ; // @phpstan-ignore nullCoalesce.property
1775- if ($ limitZeroAsAll && $ limit === 0 ) {
1781+ if ($ this ->limitZeroAsAll && $ limit === 0 ) {
17761782 $ limit = null ;
17771783 }
17781784
@@ -2498,8 +2504,7 @@ public function update($set = null, $where = null, ?int $limit = null): bool
24982504 $ this ->where ($ where );
24992505 }
25002506
2501- $ limitZeroAsAll = config (Feature::class)->limitZeroAsAll ?? true ; // @phpstan-ignore nullCoalesce.property
2502- if ($ limitZeroAsAll && $ limit === 0 ) {
2507+ if ($ this ->limitZeroAsAll && $ limit === 0 ) {
25032508 $ limit = null ;
25042509 }
25052510
@@ -2545,8 +2550,7 @@ protected function _update(string $table, array $values): string
25452550 $ valStr [] = $ key . ' = ' . $ val ;
25462551 }
25472552
2548- $ limitZeroAsAll = config (Feature::class)->limitZeroAsAll ?? true ; // @phpstan-ignore nullCoalesce.property
2549- if ($ limitZeroAsAll ) {
2553+ if ($ this ->limitZeroAsAll ) {
25502554 return 'UPDATE ' . $ this ->compileIgnore ('update ' ) . $ table . ' SET ' . implode (', ' , $ valStr )
25512555 . $ this ->compileWhereHaving ('QBWhere ' )
25522556 . $ this ->compileOrderBy ()
@@ -2829,8 +2833,7 @@ public function delete($where = '', ?int $limit = null, bool $resetData = true)
28292833
28302834 $ sql = $ this ->_delete ($ this ->removeAlias ($ table ));
28312835
2832- $ limitZeroAsAll = config (Feature::class)->limitZeroAsAll ?? true ; // @phpstan-ignore nullCoalesce.property
2833- if ($ limitZeroAsAll && $ limit === 0 ) {
2836+ if ($ this ->limitZeroAsAll && $ limit === 0 ) {
28342837 $ limit = null ;
28352838 }
28362839
@@ -3104,8 +3107,7 @@ protected function compileSelect($selectOverride = false): string
31043107 . $ this ->compileWhereHaving ('QBHaving ' )
31053108 . $ this ->compileOrderBy ();
31063109
3107- $ limitZeroAsAll = config (Feature::class)->limitZeroAsAll ?? true ; // @phpstan-ignore nullCoalesce.property
3108- if ($ limitZeroAsAll ) {
3110+ if ($ this ->limitZeroAsAll ) {
31093111 if ($ this ->QBLimit ) {
31103112 $ sql = $ this ->_limit ($ sql . "\n" );
31113113 }
0 commit comments