Skip to content

Commit

Permalink
Updated table name resolver to return null.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomshaw committed Feb 11, 2024
1 parent 80fe64d commit c1eef14
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -336,17 +336,17 @@ parameters:
path: src/DataExport.php

-
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Builder\\:\\:\\$from\\.$#"
message: "#^Call to an undefined method Illuminate\\\\Contracts\\\\Pagination\\\\LengthAwarePaginator\\:\\:getCollection\\(\\)\\.$#"
count: 1
path: src/DataSource.php

-
message: "#^Call to an undefined method Illuminate\\\\Contracts\\\\Pagination\\\\LengthAwarePaginator\\:\\:getCollection\\(\\)\\.$#"
message: "#^Call to an undefined method Illuminate\\\\Contracts\\\\Pagination\\\\LengthAwarePaginator\\:\\:setCollection\\(\\)\\.$#"
count: 1
path: src/DataSource.php

-
message: "#^Call to an undefined method Illuminate\\\\Contracts\\\\Pagination\\\\LengthAwarePaginator\\:\\:setCollection\\(\\)\\.$#"
message: "#^Call to function is_null\\(\\) with array will always evaluate to false\\.$#"
count: 1
path: src/DataSource.php

Expand Down
8 changes: 6 additions & 2 deletions src/DataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ public function filter(array $filters): void
return [$this->resolveTableNames($key) => $value];
})->toArray();

if (is_null($values)) {
continue;
}

match ($type) {
'text' => $this->handleText($values),
'number' => $this->handleNumber($values),
Expand All @@ -84,7 +88,7 @@ public function filter(array $filters): void
}
}

private function resolveTableNames($columnName): string
private function resolveTableNames($columnName): ?string
{
$baseTable = $this->query->getModel()->getTable();

Expand All @@ -102,7 +106,7 @@ private function resolveTableNames($columnName): string
}
}

return $this->query->from.'.'.$columnName;
return null;
}

private function handleText(array $values): void
Expand Down

0 comments on commit c1eef14

Please sign in to comment.