Skip to content

Commit 013de17

Browse files
committed
fix: Undefined property: Config\Feature::$limitZeroAsAll
When Config\Feature is not updated.
1 parent 0677a35 commit 013de17

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

system/BaseModel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,8 @@ public function findColumn(string $columnName)
650650
*/
651651
public function findAll(?int $limit = null, int $offset = 0)
652652
{
653-
if (config(Feature::class)->limitZeroAsAll) {
653+
$limitZeroAsAll = config(Feature::class)->limitZeroAsAll ?? true;
654+
if ($limitZeroAsAll) {
654655
$limit ??= 0;
655656
}
656657

system/Database/BaseBuilder.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,8 @@ public function orderBy(string $orderBy, string $direction = '', ?bool $escape =
14931493
*/
14941494
public function limit(?int $value = null, ?int $offset = 0)
14951495
{
1496-
if (config(Feature::class)->limitZeroAsAll && $value === 0) {
1496+
$limitZeroAsAll = config(Feature::class)->limitZeroAsAll ?? true;
1497+
if ($limitZeroAsAll && $value === 0) {
14971498
$value = null;
14981499
}
14991500

@@ -1614,7 +1615,8 @@ protected function compileFinalQuery(string $sql): string
16141615
*/
16151616
public function get(?int $limit = null, int $offset = 0, bool $reset = true)
16161617
{
1617-
if (config(Feature::class)->limitZeroAsAll && $limit === 0) {
1618+
$limitZeroAsAll = config(Feature::class)->limitZeroAsAll ?? true;
1619+
if ($limitZeroAsAll && $limit === 0) {
16181620
$limit = null;
16191621
}
16201622

@@ -1751,7 +1753,8 @@ public function getWhere($where = null, ?int $limit = null, ?int $offset = 0, bo
17511753
$this->where($where);
17521754
}
17531755

1754-
if (config(Feature::class)->limitZeroAsAll && $limit === 0) {
1756+
$limitZeroAsAll = config(Feature::class)->limitZeroAsAll ?? true;
1757+
if ($limitZeroAsAll && $limit === 0) {
17551758
$limit = null;
17561759
}
17571760

@@ -2473,7 +2476,8 @@ public function update($set = null, $where = null, ?int $limit = null): bool
24732476
$this->where($where);
24742477
}
24752478

2476-
if (config(Feature::class)->limitZeroAsAll && $limit === 0) {
2479+
$limitZeroAsAll = config(Feature::class)->limitZeroAsAll ?? true;
2480+
if ($limitZeroAsAll && $limit === 0) {
24772481
$limit = null;
24782482
}
24792483

@@ -2518,7 +2522,8 @@ protected function _update(string $table, array $values): string
25182522
$valStr[] = $key . ' = ' . $val;
25192523
}
25202524

2521-
if (config(Feature::class)->limitZeroAsAll) {
2525+
$limitZeroAsAll = config(Feature::class)->limitZeroAsAll ?? true;
2526+
if ($limitZeroAsAll) {
25222527
return 'UPDATE ' . $this->compileIgnore('update') . $table . ' SET ' . implode(', ', $valStr)
25232528
. $this->compileWhereHaving('QBWhere')
25242529
. $this->compileOrderBy()
@@ -2794,7 +2799,8 @@ public function delete($where = '', ?int $limit = null, bool $resetData = true)
27942799

27952800
$sql = $this->_delete($this->removeAlias($table));
27962801

2797-
if (config(Feature::class)->limitZeroAsAll && $limit === 0) {
2802+
$limitZeroAsAll = config(Feature::class)->limitZeroAsAll ?? true;
2803+
if ($limitZeroAsAll && $limit === 0) {
27982804
$limit = null;
27992805
}
28002806

@@ -3064,7 +3070,8 @@ protected function compileSelect($selectOverride = false): string
30643070
. $this->compileWhereHaving('QBHaving')
30653071
. $this->compileOrderBy();
30663072

3067-
if (config(Feature::class)->limitZeroAsAll) {
3073+
$limitZeroAsAll = config(Feature::class)->limitZeroAsAll ?? true;
3074+
if ($limitZeroAsAll) {
30683075
if ($this->QBLimit) {
30693076
$sql = $this->_limit($sql . "\n");
30703077
}

system/Database/SQLSRV/Builder.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ protected function _limit(string $sql, bool $offsetIgnore = false): string
313313
// DatabaseException:
314314
// [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The number of
315315
// rows provided for a FETCH clause must be greater then zero.
316-
if (! config(Feature::class)->limitZeroAsAll && $this->QBLimit === 0) {
316+
$limitZeroAsAll = config(Feature::class)->limitZeroAsAll ?? true;
317+
if (! $limitZeroAsAll && $this->QBLimit === 0) {
317318
return "SELECT * \nFROM " . $this->_fromTables() . ' WHERE 1=0 ';
318319
}
319320

@@ -599,7 +600,8 @@ protected function compileSelect($selectOverride = false): string
599600
. $this->compileOrderBy(); // ORDER BY
600601

601602
// LIMIT
602-
if (config(Feature::class)->limitZeroAsAll) {
603+
$limitZeroAsAll = config(Feature::class)->limitZeroAsAll ?? true;
604+
if ($limitZeroAsAll) {
603605
if ($this->QBLimit) {
604606
$sql = $this->_limit($sql . "\n");
605607
}
@@ -618,7 +620,8 @@ protected function compileSelect($selectOverride = false): string
618620
*/
619621
public function get(?int $limit = null, int $offset = 0, bool $reset = true)
620622
{
621-
if (config(Feature::class)->limitZeroAsAll && $limit === 0) {
623+
$limitZeroAsAll = config(Feature::class)->limitZeroAsAll ?? true;
624+
if ($limitZeroAsAll && $limit === 0) {
622625
$limit = null;
623626
}
624627

system/Model.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ protected function doFindColumn(string $columnName)
252252
*/
253253
protected function doFindAll(?int $limit = null, int $offset = 0)
254254
{
255-
if (config(Feature::class)->limitZeroAsAll) {
255+
$limitZeroAsAll = config(Feature::class)->limitZeroAsAll ?? true;
256+
if ($limitZeroAsAll) {
256257
$limit ??= 0;
257258
}
258259

0 commit comments

Comments
 (0)