aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2021-07-11 19:59:05 +0200
committerThomas Lange <code@nerdmind.de>2021-07-11 19:59:05 +0200
commita4242144eebc101bc1e5ec150a80312e30d0112f (patch)
tree5c41416352f5bc12563122c0cff05fdd6b613b89
parent42da9bd4bb6d35706ee5fefd3bac9b60ac5ada34 (diff)
downloadblog-a4242144eebc101bc1e5ec150a80312e30d0112f.tar.gz
blog-a4242144eebc101bc1e5ec150a80312e30d0112f.tar.xz
blog-a4242144eebc101bc1e5ec150a80312e30d0112f.zip
Modify parameter list for getAll method
-rw-r--r--core/include/category/main.php3
-rw-r--r--core/namespace/ORM/Repository.php6
2 files changed, 5 insertions, 4 deletions
diff --git a/core/include/category/main.php b/core/include/category/main.php
index b1bea72..2e84aa1 100644
--- a/core/include/category/main.php
+++ b/core/include/category/main.php
@@ -90,7 +90,8 @@ if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) {
$posts = $PostRepository->getAll(
['category' => $Category->getID()],
$site_sort,
- ($currentSite-1) * $site_size.','.$site_size
+ $site_size,
+ ($currentSite-1) * $site_size
);
foreach($posts as $Post) {
diff --git a/core/namespace/ORM/Repository.php b/core/namespace/ORM/Repository.php
index 929dae3..c0677a9 100644
--- a/core/namespace/ORM/Repository.php
+++ b/core/namespace/ORM/Repository.php
@@ -213,13 +213,13 @@ abstract class Repository {
# Get paginated entity list
#===========================================================================
public function getPaginated(string $order, int $limit, int $offset = 0): array {
- return $this->getAll([], $order, "$offset,$limit");
+ return $this->getAll([], $order, $limit, $offset);
}
#===========================================================================
# Get all entities
#===========================================================================
- public function getAll(array $filter = [], string $order = null, string $limit = null): array {
+ public function getAll(array $filter = [], string $order = null, int $limit = null, int $offset = 0): array {
$select = 'SELECT * FROM '.static::getTableName();
$wheres = [];
$params = [];
@@ -242,7 +242,7 @@ abstract class Repository {
}
if($limit) {
- $limit = "LIMIT $limit";
+ $limit = "LIMIT $offset,$limit";
}
$query = "$select %s %s %s";