Skip to content

Commit

Permalink
Expand pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
sroehrl authored Nov 10, 2024
1 parent 57d16f9 commit be57292
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
color: ${{ env.BADGE_COLOR }}
path: '.github/badges/test-badge.svg'
- name: Upload badge as artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: badge
path: '.github/badges/test-badge.svg'
Expand Down
5 changes: 5 additions & 0 deletions src/Model/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ public static function retrieve(array $condition = [], array $filter = []): Coll
{
self::interpret();
$select = self::$tableName . '.' . self::$interpreter->getPrimaryKey();
foreach ($condition as $key => $value) {
if(str_contains($key, '.')) {
$select .= ' ' . $key;
}
}
$results = Database::easy($select, $condition, $filter);

$collection = new Collection();
Expand Down
5 changes: 5 additions & 0 deletions src/Model/Paginate.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public function get(): array
$modelDescription = $this->model::declare();
$table = array_key_first($modelDescription);
$select = $table . '.' . $modelDescription[$table][0]['name'];
foreach ($condition as $key => $value) {
if(str_contains($key, '.')) {
$select .= ' ' . $key;
}
}
$total = count(Database::easy($select, $this->condition));
$start = ($this->page - 1) * $this->pageSize;
$callFunctions = [];
Expand Down

0 comments on commit be57292

Please sign in to comment.